// tag = tag name // newTag = full new contents including outer tag // replaces only one occurrence static S hreplacetag(S html, S tag, S newTag) { L<S> tok = htmlcoarsetok(html); L<L<S>> tags = findContainerTag(tok, tag); if (empty(tags)) ret html; L<S> theTag = first(tags); L<S> actualTag = subList(theTag, 1, l(theTag)-1); ret join(replaceSubList(cloneList(tok), actualTag, litlist(newTag))); }
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: | 750 / 732 |
| Referenced in: | [show references] |