Talk:Display an outline as a nested table: Difference between revisions

 
(2 intermediate revisions by the same user not shown)
Line 31:
 
In practice, of course, an indented text outline will often have several top level (unindented) lines.
To put it another way, many outlines represent forests – lists of trees – rather than single trees (or can otherwise be thought of as a single tree with a hidden virtual root).
 
FWIW I've updated the Haskell, JavaScript and Functional Python versions here to allow for the forest case by writing out a series of (wiki) tables, one for each tree, separated by a couple of linefeeds.
[[User:Hout|Hout]] ([[User talk:Hout|talk]]) 15:19, 6 September 2021 (UTC)
 
For example, a forest outline – with several top-level nodes – like:
<pre>alpha
beta
gamma
delta
epsilon
zeta
eta
theta
iota</pre>
 
might be rendered by the following sequence of space-separated tree-tables:
{| class="wikitable" style="text-align: center;"
|-
| style="background: #ffffe6; " colspan=2 | alpha
|-
| style="background: #ffebd2; " | beta
| style="background: #f0fff0; " | gamma
|}
 
{| class="wikitable" style="text-align: center;"
|-
| style="background: #ffffe6; " colspan=2 | delta
|-
| style="background: #ffebd2; " | epsilon
| style="background: #f0fff0; " | zeta
|}
 
{| class="wikitable" style="text-align: center;"
|-
| style="background: #ffffe6; " colspan=2 | eta
|-
| style="background: #ffebd2; " | theta
| style="background: #f0fff0; " | iota
|}
[[User:Hout|Hout]] ([[User talk:Hout|talk]]) 15:41, 6 September 2021 (UTC)
 
where the following (single root / tree):
 
<pre>top level
alpha
beta
gamma
delta
epsilon
zeta
eta
theta
iota</pre>
 
would have rendered as:
{| class="wikitable" style="text-align: center;"
|-
| style="background: #ffffe6; " colspan=6 | top level
|-
| style="background: #ffebd2; " colspan=2 | alpha
| style="background: #f0fff0; " colspan=2 | delta
| style="background: #e6ffff; " colspan=2 | eta
|-
| style="background: #ffebd2; " | beta
| style="background: #ffebd2; " | gamma
| style="background: #f0fff0; " | epsilon
| style="background: #f0fff0; " | zeta
| style="background: #e6ffff; " | theta
| style="background: #e6ffff; " | iota
|}
[[User:Hout|Hout]] ([[User talk:Hout|talk]]) 15:49, 6 September 2021 (UTC)
9,655

edits