tweak conversion from wide table to indented list

main
Lee Hanken 2022-04-02 13:36:48 +01:00
parent acd7b1b6c2
commit 91044556da
1 changed files with 21 additions and 8 deletions

View File

@ -101,17 +101,30 @@ module.exports = {
// too wide so output indented instead
result += "\n";
for (let r=0;r<n_rows;r++) {
result += "* ";
result += items[r][0];
result += "\n";
for (let c=1;c<n_cols;c++) {
result += " * ";
result += items[r][c];
for (let r=1;r<n_rows;r++) {
if (items[0][0] || items[r][0])
result += "* ";
if (items[0][0]) {
result += items[0][0];
result += ": ";
}
if (items[r][0])
result += items[r][0];
if (items[0][0] || items[r][0])
result += "\n";
for (let c=1;c<n_cols;c++) {
if (items[0][c] || items[r][c])
result += " * ";
if (items[0][c]) {
result += items[0][c];
result += ": ";
}
if (items[r][c])
result += items[r][c];
if (items[0][c] || items[r][c])
result += "\n";
}
}
}
return result;