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

14
LINES

< > BotCompany Repo | #1011339 // html_addTargetBlank

JavaX fragment (include)

static S html_addTargetBlank(S html) {
  L<S> tok = htmlTok(html);
  for (int i = 1; i < l(tok); i += 2) pcall {
    S t = tok.get(i);
    if (isTag(t, "a")) {
      SS map = htmlParams(t);
      if (map.containsKey("href")) {
        map.put("target", "_blank");
        tok.set(i, hopeningTag("a", mapToParams(map)));
      }
    }
  }
  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: #1011339
Snippet name: html_addTargetBlank
Eternal ID of this version: #1011339/6
Text MD5: 75f9f5b0dcdea7c8602237c4d66c5264
Author: stefan
Category: javax / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-05 09:07:27
Source code size: 369 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 395 / 418
Version history: 5 change(s)
Referenced in: [show references]