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)

1  
sS jlabel_fixImages(S html) {
2  
  L<S> tok = htmlTok(html);
3  
  for (int i = 1; i < l(tok); i += 2) {
4  
    S t = tok.get(i);
5  
    continue unless tagIs(t, "img");
6  
    SS params = htmlParams(t);
7  
    S src = params.get("src");
8  
    continue unless isSnippetID(src);
9  
    pcall {
10  
      File f = loadImageAsFile(src);
11  
      params = mapPlus(params, "src", /*f2s(f)*/f.toURI());
12  
      tok.set(i, hopeningTag("img", params));
13  
    }
14  
  }
15  
  ret join(tok);
16  
}

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: 556 / 596
Version history: 5 change(s)
Referenced in: [show references]