Display an outline as a nested table: Difference between revisions
Display an outline as a nested table (view source)
Revision as of 07:15, 6 September 2021
, 2 years ago→{{header|Haskell}}: Updated to allow for writing several tables, where outline has several top-level roots
(→Python: Functional: Adjusted to allow for outlines with more than one root (forests, rather than trees)) |
(→{{header|Haskell}}: Updated to allow for writing several tables, where outline has several top-level roots) |
||
Line 513:
import Data.Tree (Tree (..), foldTree, levels)
---------------- NESTED
intercalate "\n\n" $
wikiTableFromTree colorSwatch
. indentLevelsFromLines▼
. lines▼
)
outline
wikiTableFromTree :: [String] -> Tree String -> String
wikiTableFromTree colorSwatch =
wikiTableFromRows
. levels
Line 522 ⟶ 532:
. widthLabelledTree
. (paddedTree [] =<< treeDepth)
▲ . forestFromLineIndents
▲ . indentLevelsFromLines
▲ . lines
--------------------------- TEST -------------------------
Line 531 ⟶ 537:
main =
( putStrLn
.
[ "#ffffe6",
"#ffebd2",
|