1 | // tag = tag name |
2 | // newTag = full new contents including outer tag |
3 | // replaces only one occurrence |
4 | // returns pair(new text, extracted tag) |
5 | static Pair<S> hextracttag(S html, S tag) { |
6 | L<S> tok = htmlcoarsetok(html); |
7 | L<L<S>> tags = findContainerTag(tok, tag); |
8 | if (empty(tags)) ret pair(html, null); |
9 | L<S> theTag = first(tags); |
10 | L<S> actualTag = subList(theTag, 1, l(theTag)-1); |
11 | S s = join(actualTag); |
12 | ret pair(join(replaceSubList(cloneList(tok), actualTag, emptyList())), s); |
13 | } |
Began life as a copy of #1003267
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: | #1014931 |
Snippet name: | hextracttag - extract a tag from HTML replace it with nothing |
Eternal ID of this version: | #1014931/2 |
Text MD5: | 08fed6fd2f0f18991a3d4c2dec4cc9cd |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-06 15:28:43 |
Source code size: | 501 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 430 / 436 |
Version history: | 1 change(s) |
Referenced in: | [show references] |