Display an outline as a nested table: Difference between revisions
Content added Content deleted
m (J: lighter random colors) |
(J: bugfix (use generated colors as colors rather than as a limiting color range) |
||
Line 683: | Line 683: | ||
}} |
}} |
||
NB. avoid dark colors |
|||
NB. avoid dark colors |
NB. avoid dark colors |
||
pastel=: {{256#.192+?m$,:3#64}} |
pastel=: {{256#.192+?m$,:3#64}} |
||
Line 695: | Line 696: | ||
widths=. width tr NB. column widths |
widths=. width tr NB. column widths |
||
top=. I.2>dr |
top=. I.2>dr |
||
color=.<"1 hfd ''pastel (I.tr e.pad)} (top top} tr)&{^:_ |
color=.<"1 hfd ''pastel (I.tr e.pad)} (top top} tr)&{^:_ (#dr)pastel |
||
r=.'{| class="wikitable" style="text-align: center;"',LF |
r=.'{| class="wikitable" style="text-align: center;"',LF |
||
for_d.~.dr do. NB. descend through the depths |
for_d.~.dr do. NB. descend through the depths |
||
Line 728: | Line 729: | ||
{| class="wikitable" style="text-align: center;" |
{| class="wikitable" style="text-align: center;" |
||
|- |
|- |
||
| style="background: # |
| style="background: #cdead6" colspan=7 | Display an outline as a nested table. |
||
|- |
|- |
||
| style="background: # |
| style="background: #c0f1e1" colspan=3 | Parse the outline to a tree, |
||
| style="background: # |
| style="background: #f3dbd1" colspan=2 | count the leaves descending from each node, |
||
| style="background: # |
| style="background: #cae2dc" colspan=2 | and write out a table with 'colspan' values |
||
|- |
|- |
||
| style="background: # |
| style="background: #c0f1e1" colspan=1 | measuring the indent of each line, |
||
| style="background: # |
| style="background: #c0f1e1" colspan=1 | translating the indentation to a nested structure, |
||
| style="background: # |
| style="background: #c0f1e1" colspan=1 | and padding the tree to even depth. |
||
| style="background: # |
| style="background: #f3dbd1" colspan=1 | defining the width of a leaf as 1, |
||
| style="background: # |
| style="background: #f3dbd1" colspan=1 | and the width of a parent node as a sum. |
||
| style="background: # |
| style="background: #cae2dc" colspan=1 | either as a wiki table, |
||
| style="background: # |
| style="background: #cae2dc" colspan=1 | or as HTML. |
||
|- |
|- |
||
| style="background: # |
| style="background: #c9e3ff" colspan=1 | |
||
| style="background: # |
| style="background: #c9e3ff" colspan=1 | |
||
| style="background: # |
| style="background: #c9e3ff" colspan=1 | |
||
| style="background: # |
| style="background: #c9e3ff" colspan=1 | |
||
| style="background: # |
| style="background: #f3dbd1" colspan=1 | (The sum of the widths of its children) |
||
| style="background: # |
| style="background: #c9e3ff" colspan=1 | |
||
| style="background: # |
| style="background: #c9e3ff" colspan=1 | |
||
|} |
|} |
||