title: $:/core/macros/tree tags: $:/tags/Macro \define leaf-link(full-title, chunk) <$link to=<<__full-title__>>><$text text=<<__chunk__>>/> \end \define leaf-node(prefix, chunk)
  • <$list filter="[<__prefix__>addsuffix<__chunk__>is[shadow]] [<__prefix__>addsuffix<__chunk__>is[tiddler]]" variable="full-title"> <$list filter="[removeprefix<__prefix__>]" variable="chunk"> {{$:/core/images/file}} <$macrocall $name="leaf-link" full-title=<> chunk=<>/>
  • \end \define branch-node(prefix, chunk)
  • <$set name="reveal-state" value={{{ [[$:/state/tree/]addsuffix<__prefix__>addsuffix<__chunk__>] }}}> <$reveal type="nomatch" stateTitle=<> text="show"> <$button setTitle=<> setTo="show" class="tc-btn-invisible"> {{$:/core/images/folder}} <$text text=<<__chunk__>>/> <$reveal type="match" stateTitle=<> text="show"> <$button setTitle=<> setTo="hide" class="tc-btn-invisible"> {{$:/core/images/folder}} <$text text=<<__chunk__>>/> (<$count filter="[all[shadows+tiddlers]removeprefix<__prefix__>removeprefix<__chunk__>] -[<__prefix__>addsuffix<__chunk__>]"/>) <$reveal type="match" stateTitle=<> text="show"> <$macrocall $name="tree-node" prefix={{{ [<__prefix__>addsuffix<__chunk__>] }}}/>
  • \end \define tree-node(prefix)
      <$list filter="[all[shadows+tiddlers]removeprefix<__prefix__>splitbefore[/]sort[]!suffix[/]]" variable="chunk"> <$macrocall $name="leaf-node" prefix=<<__prefix__>> chunk=<>/> <$list filter="[all[shadows+tiddlers]removeprefix<__prefix__>splitbefore[/]sort[]suffix[/]]" variable="chunk"> <$macrocall $name="branch-node" prefix=<<__prefix__>> chunk=<>/>
    \end \define tree(prefix: "$:/")
    <$text text=<<__prefix__>>/>
    <$macrocall $name="tree-node" prefix=<<__prefix__>>/>
    \end