sS hcrud_mergeTables(S table1, S table2, S connector) { LS tok1 = htmlTok(table1), tok2 = htmlTok(table2); LS tbl1 = first(findContainerTag(tok1, "table")); LS tbl2 = first(findContainerTag(tok2, "table")); if (tbl1 == null) ret table2; if (tbl2 == null) ret table1; LLS rows1 = findContainerTag(tbl1, "tr"); LLS rows2 = findContainerTag(tbl2, "tr"); print("rows1: " + l(rows1) + ", rows2: " + l(rows2)); int nRows = max(l(rows1), l(rows2)); new LS rows; for i to nRows: { LS row1 = dropFirstTwoAndLastTwo(get(rows1, i)); LS row2 = dropFirstTwoAndLastTwo(get(rows2, i)); row2 = dropFirst(row2, indexOfIC(row2, "")+1); // drop the 1., 2., 3. rows.add(tr(join(concatLists(row1, ll(td(connector)), row2)))); } replaceTokens(tbl1, 2, l(tbl1)-2, lines(rows)); ret join(tok1); }