// tok should be the output of htmlcoarsetok static L dropAllTags(L tok) { new L list; for i over tok: { S t = tok.get(i); if (odd(i) && t.startsWith("<")) { list.set(list.size()-1, list.get(list.size()-1) + tok.get(i+1)); ++i; } else list.add(t); } return list; } // alternatively, call this convenient function static S dropAllTags(S html) { if (!contains(html, '<')) ret html; return join(dropAllTags(htmlcoarsetok(html))); }