Transpiled version (3150L) is out of date.
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, "</td>")+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); }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030003 |
Snippet name: | hcrud_mergeTables - merge tables side by side (e.g. for gazelle.rocks UserPost CRUD, dev.) |
Eternal ID of this version: | #1030003/7 |
Text MD5: | 321d927f9d5b89d0e762425035180e4f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-06-28 22:36:27 |
Source code size: | 840 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 207 / 324 |
Version history: | 6 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |