1 | // tag = tag name |
2 | // newTag = full new contents including outer tag |
3 | // replaces only one occurrence |
4 | static S hreplacetag(S html, S tag, S newTag) { |
5 | L<S> tok = htmlcoarsetok(html); |
6 | L<L<S>> tags = findContainerTag(tok, tag); |
7 | if (empty(tags)) ret html; |
8 | L<S> theTag = first(tags); |
9 | L<S> actualTag = subList(theTag, 1, l(theTag)-1); |
10 | ret join(replaceSubList(cloneList(tok), actualTag, litlist(newTag))); |
11 | } |
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: | #1003267 |
Snippet name: | hreplacetag - replace a tag in HTML source |
Eternal ID of this version: | #1003267/1 |
Text MD5: | 5f8f09276af546099fce954fb83e62e9 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-06-12 19:51:06 |
Source code size: | 420 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 532 / 509 |
Referenced in: | [show references] |