Display an outline as a nested table: Difference between revisions
Content added Content deleted
(→Python: Functional: Adjusted to allow for outlines with more than one root (forests, rather than trees)) |
|||
Line 2,349: | Line 2,349: | ||
# |
# wikiTablesFromOutline :: [String] -> String -> String |
||
def |
def wikiTablesFromOutline(colorSwatch): |
||
'''Wikitable markup for |
'''Wikitable markup for (colspan) tables representing |
||
the indentation of a given outline. |
|||
Each key-line point (child of |
Each key-line point (child of a tree root) has a |
||
distinct color, inherited by all its descendants. |
distinct color, inherited by all its descendants. |
||
The first color in the swatch is for the root node. |
The first color in the swatch is for the root node. |
||
A sequence of tables is generated where the outline |
|||
represents a forest rather than a singly-rooted tree. |
|||
''' |
''' |
||
def go( |
def go(outline): |
||
return '\n\n'.join([ |
|||
wikiTableFromTree(colorSwatch)(tree) for tree in |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
]) |
|||
return go |
|||
# wikiTableFromTree :: [String] -> Tree String -> String |
|||
def wikiTableFromTree(colorSwatch): |
|||
'''A wikitable rendered from a single tree''' |
|||
def go(tree): |
|||
return compose( |
return compose( |
||
wikiTableFromRows, |
wikiTableFromRows, |
||
Line 2,363: | Line 2,380: | ||
paintedTree(colorSwatch), |
paintedTree(colorSwatch), |
||
widthMeasuredTree, |
widthMeasuredTree, |
||
fullDepthTree |
fullDepthTree |
||
)(tree) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
return go |
return go |
||
Line 2,392: | Line 2,405: | ||
print( |
print( |
||
wikiTablesFromOutline([ |
|||
"#ffffe6", |
"#ffffe6", |
||
"#ffebd2", |
"#ffebd2", |