// tok must come from htmlTok // returns all container tags found (including content) as CNC // should be OK for both HTML and XML static LL<S> findContainerTag(L<S> tok, S tag) { new LL<S> l; for (int i = 1; i < l(tok); i += 2) if (isOpeningTag(tok.get(i), tag)) { int j, level = 1; for (j = i+2; j < tok.size(); j += 2) if (isOpeningTag(tok.get(j), tag)) ++level; else if (isTag(tok.get(j), "/" + tag)) { --level; if (level == 0) { l.add(subList(tok, i-1, j+2)); // actual CNC break; } } i = j; } ret l; } static LL<S> findContainerTag(S html, S tag) { ret findContainerTag(htmlTok(html), tag); }
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