Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

18
LINES

< > BotCompany Repo | #1007541 // dynamizeGlobalIDsInHTML

JavaX fragment (include)

static S dynamizeGlobalIDsInHTML(S html) {
  L<S> tok = htmlTok(html);
  Pattern pat = Pattern.compile("([^a-z])([a-z]{16})(?![a-z\\(])");
  for (int i = 0; i < l(tok); i += 2) { // skip tags
    S t = " " + tok.get(i) + " ";
    Matcher m = pat.matcher(t);
    new StringBuffer buf;
    while (m.find()) {
      S id = m.group(2);
      S name = conceptToNameOpt(id);
      mreplace(m, buf, 
        m.group(1) + ahref(intelligenceMachineLink(id), id, "title", name));
    }
    m.appendTail(buf);
    tok.set(i, dropFirstAndLast(str(buf)));
  }
  ret join(tok);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1007541
Snippet name: dynamizeGlobalIDsInHTML
Eternal ID of this version: #1007541/5
Text MD5: 535f9d93dd406d8ffa94d67c783d6b77
Author: stefan
Category: javax / a.i. / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-04 19:12:20
Source code size: 582 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 495 / 520
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)