Jump to content

Display an outline as a nested table: Difference between revisions

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

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.