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

16
LINES

< > BotCompany Repo | #1016070 // jlabel_fixImages - make (e.g.) <img src="#1101285"> tags work

JavaX fragment (include)

sS jlabel_fixImages(S html) {
  L<S> tok = htmlTok(html);
  for (int i = 1; i < l(tok); i += 2) {
    S t = tok.get(i);
    continue unless tagIs(t, "img");
    SS params = htmlParams(t);
    S src = params.get("src");
    continue unless isSnippetID(src);
    pcall {
      File f = loadImageAsFile(src);
      params = mapPlus(params, "src", /*f2s(f)*/f.toURI());
      tok.set(i, hopeningTag("img", params));
    }
  }
  ret join(tok);
}

Author comment

Began life as a copy of #1016069

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: #1016070
Snippet name: jlabel_fixImages - make (e.g.) <img src="#1101285"> tags work
Eternal ID of this version: #1016070/6
Text MD5: 471b3728f4d8f5a6956993fad76f5192
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-05 12:03:04
Source code size: 455 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 563 / 604
Version history: 5 change(s)
Referenced in: [show references]