// if block exists: put tag before // if not: append to whole HTML // TODO: use something better than findContainerTag sS hAddToBody(S html, S contents) { if (emptyAfterTrim(contents)) ret html; L tok = htmlTok(html); LS body = first(findContainerTag(tok, "body")); if (body == null) ret joinWithEmptyLines(html, contents); int i = l(body)-3; body.set(i, joinWithEmptyLines(body.get(i), contents)); ret join(tok); }