diff --git a/core/wiki/macros/tree.tid b/core/wiki/macros/tree.tid index f73bd54fd..fd849a2a8 100644 --- a/core/wiki/macros/tree.tid +++ b/core/wiki/macros/tree.tid @@ -1,22 +1,15 @@ title: $:/core/macros/tree tags: $:/tags/Macro -\define leaf-link(full-title,chunk,separator: "/") -<$link to=<<__full-title__>>><$text text=<<__chunk__>>/> -\end - -\define leaf-node(prefix,chunk) +\define leaf-node(chunk,title) \whitespace trim
  • -<$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=<>/> - - +{{$:/core/images/file}} +<$link to=<<__title__>>><$text text=<<__chunk__>>/>
  • \end -\define branch-node(prefix,chunk,separator: "/") +\define branch-node(prefix,chunk,separator: "/",field: "title") \whitespace trim
  • <$set name="reveal-state" value={{{ [[$:/state/tree/]addsuffix<__prefix__>addsuffix<__chunk__>] }}}> @@ -31,32 +24,34 @@ tags: $:/tags/Macro -(<$count filter="[all[shadows+tiddlers]removeprefix<__prefix__>removeprefix<__chunk__>] -[<__prefix__>addsuffix<__chunk__>]"/>) +(<$count filter="[all[shadows+tiddlers]get<__field__>removeprefix<__prefix__>removeprefix<__chunk__>] -[<__prefix__>addsuffix<__chunk__>]"/>) <$reveal type="match" stateTitle=<> text="show"> -<$macrocall $name="tree-node" prefix={{{ [<__prefix__>addsuffix<__chunk__>] }}} separator=<<__separator__>>/> +<$macrocall $name="tree-node" prefix={{{ [<__prefix__>addsuffix<__chunk__>] }}} separator=<<__separator__>> field=<<__field__>>/>
  • \end -\define tree-node(prefix,separator: "/") +\define tree-node(prefix,separator: "/",field: "title") \whitespace trim
      -<$list filter="[all[shadows+tiddlers]removeprefix<__prefix__>splitbefore<__separator__>sort[]!suffix<__separator__>]" variable="chunk"> -<$macrocall $name="leaf-node" prefix=<<__prefix__>> chunk=<> separator=<<__separator__>>/> +<$list filter="[all[shadows+tiddlers]get<__field__>prefix<__prefix__>removeprefix<__prefix__>splitbefore<__separator__>sort[]!suffix<__separator__>]" variable="chunk"> +<$list filter="[all[shadows+tiddlers]has<__field__>sort[]] :filter[get<__field__>removeprefix<__prefix__>match]" variable="title"> +<$macrocall $name="leaf-node" prefix=<<__prefix__>> chunk=<> title=<> separator=<<__separator__>>/> </$list> -<$list filter="[all[shadows+tiddlers]removeprefix<__prefix__>splitbefore<__separator__>sort[]suffix<__separator__>]" variable="chunk"> -<$macrocall $name="branch-node" prefix=<<__prefix__>> chunk=<<chunk>> separator=<<__separator__>>/> +</$list> +<$list filter="[all[shadows+tiddlers]get<__field__>prefix<__prefix__>removeprefix<__prefix__>splitbefore<__separator__>sort[]suffix<__separator__>]" variable="chunk"> +<$macrocall $name="branch-node" prefix=<<__prefix__>> chunk=<<chunk>> separator=<<__separator__>> field=<<__field__>>/> </$list> </ol> \end -\define tree(prefix: "$:/",separator: "/") +\define tree(prefix: "$:/",separator: "/",field: "title") \whitespace trim <div class="tc-tree"> <span><$text text=<<__prefix__>>/></span> <div> -<$macrocall $name="tree-node" prefix=<<__prefix__>> separator=<<__separator__>>/> +<$macrocall $name="tree-node" prefix=<<__prefix__>> separator=<<__separator__>> field=<<__field__>>/> </div> </div> \end