1 | // tok must come from htmlTok |
2 | // returns all container tags found (including content) as CNC |
3 | // might not be correct with HTML sources |
4 | static L<L<S>> findContainerTags(L<S> tok) { |
5 | new L<L<S>> l; |
6 | for (int i = 1; i < l(tok); i += 2) |
7 | if (isOpeningTag(tok.get(i))) { |
8 | int j, level = 1; |
9 | for (j = i+2; j < tok.size(); j += 2) |
10 | if (isOpeningTag(tok.get(j))) |
11 | ++level; |
12 | else if (isClosingTag(tok.get(j))) { |
13 | --level; |
14 | if (level == 0) { |
15 | l.add(subList(tok, i-1, j+2)); // actual CNC |
16 | break; |
17 | } |
18 | } |
19 | i = j; |
20 | } |
21 | ret l; |
22 | } |
Began life as a copy of #1002309
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: | #1007927 |
Snippet name: | findContainerTags - HTML/XML parsing |
Eternal ID of this version: | #1007927/4 |
Text MD5: | 4e8a7eec69e26347f0a458be1ecf800b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-07-24 03:12:59 |
Source code size: | 636 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 526 / 553 |
Version history: | 3 change(s) |
Referenced in: | [show references] |