Display an outline as a nested table: Difference between revisions
Display an outline as a nested table (view source)
Revision as of 07:07, 6 September 2021
, 2 years ago→Python: Functional: Adjusted to allow for outlines with more than one root (forests, rather than trees)
(→Python: Functional: Adjusted to allow for outlines with more than one root (forests, rather than trees)) |
|||
Line 2,349:
#
def
'''Wikitable markup for
Each key-line point (child of
distinct color, inherited by all its descendants.
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(
return '\n\n'.join([
wikiTableFromTree(colorSwatch)(tree) for tree in
indentLevelsFromLines(▼
)▼
])
return go
# wikiTableFromTree :: [String] -> Tree String -> String
def wikiTableFromTree(colorSwatch):
'''A wikitable rendered from a single tree'''
def go(tree):
return compose(
wikiTableFromRows,
Line 2,363 ⟶ 2,380:
paintedTree(colorSwatch),
widthMeasuredTree,
fullDepthTree
▲ forestFromLevels,
▲ indentLevelsFromLines
▲ )(
▲ s.splitlines()
▲ )
return go
Line 2,392 ⟶ 2,405:
print(
"#ffffe6",
"#ffebd2",
|