2017-06-28 16:44:15 +00:00
|
|
|
title: $:/core/macros/tree
|
|
|
|
tags: $:/tags/Macro
|
|
|
|
|
2024-12-05 12:40:13 +00:00
|
|
|
\procedure leaf-link(full-title,chunk,separator: "/")
|
|
|
|
<$link to=<<full-title>>><$text text=<<chunk>>/></$link>
|
2018-11-19 10:50:09 +00:00
|
|
|
\end
|
|
|
|
|
2022-03-26 15:19:04 +00:00
|
|
|
\whitespace trim
|
2024-12-05 12:40:13 +00:00
|
|
|
\procedure leaf-node(prefix,chunk)
|
2017-06-28 16:44:15 +00:00
|
|
|
<li>
|
2024-12-05 12:40:13 +00:00
|
|
|
<$list filter="[<prefix>addsuffix<chunk>is[shadow]] [<prefix>addsuffix<chunk>is[tiddler]]" variable="full-title">
|
|
|
|
<$list filter="[<full-title>removeprefix<prefix>]" variable="chunk">
|
|
|
|
<span class="tc-tiny-gap-right">{{$:/core/images/file}}</span><$transclude $variable="leaf-link" full-title=<<full-title>> chunk=<<chunk>>/>
|
2018-11-19 10:50:09 +00:00
|
|
|
</$list>
|
2017-06-28 16:44:15 +00:00
|
|
|
</$list>
|
|
|
|
</li>
|
|
|
|
\end
|
|
|
|
|
2024-12-05 12:40:13 +00:00
|
|
|
\procedure branch-node(prefix,chunk,separator: "/")
|
2018-11-19 10:50:09 +00:00
|
|
|
<li>
|
2024-12-05 12:40:13 +00:00
|
|
|
<$set name="reveal-state" value={{{ [[$:/state/tree/]addsuffix<prefix>addsuffix<chunk>] }}}>
|
2018-11-19 10:50:09 +00:00
|
|
|
<$reveal type="nomatch" stateTitle=<<reveal-state>> text="show">
|
|
|
|
<$button setTitle=<<reveal-state>> setTo="show" class="tc-btn-invisible">
|
2024-12-05 12:40:13 +00:00
|
|
|
{{$:/core/images/folder}} <$text text=<<chunk>>/>
|
2018-11-19 10:50:09 +00:00
|
|
|
</$button>
|
2017-06-28 16:44:15 +00:00
|
|
|
</$reveal>
|
2018-11-19 10:50:09 +00:00
|
|
|
<$reveal type="match" stateTitle=<<reveal-state>> text="show">
|
|
|
|
<$button setTitle=<<reveal-state>> setTo="hide" class="tc-btn-invisible">
|
2024-12-05 12:40:13 +00:00
|
|
|
{{$:/core/images/folder}} <$text text=<<chunk>>/>
|
2018-11-19 10:50:09 +00:00
|
|
|
</$button>
|
2017-06-28 16:44:15 +00:00
|
|
|
</$reveal>
|
2024-12-05 12:40:13 +00:00
|
|
|
<span class="tc-tiny-gap-left">(<$count filter="[all[shadows+tiddlers]removeprefix<prefix>removeprefix<chunk>] -[<prefix>addsuffix<chunk>]"/>)</span>
|
2018-11-19 10:50:09 +00:00
|
|
|
<$reveal type="match" stateTitle=<<reveal-state>> text="show">
|
2024-12-05 12:40:13 +00:00
|
|
|
<$transclude $variable="tree-node" prefix={{{ [<prefix>addsuffix<chunk>] }}} separator=<<separator>>/>
|
2017-06-28 16:44:15 +00:00
|
|
|
</$reveal>
|
2018-11-19 10:50:09 +00:00
|
|
|
</$set>
|
2017-06-28 16:44:15 +00:00
|
|
|
</li>
|
|
|
|
\end
|
|
|
|
|
2024-12-05 12:40:13 +00:00
|
|
|
\procedure tree-node(prefix,separator: "/")
|
2017-06-28 16:44:15 +00:00
|
|
|
<ol>
|
2024-12-05 12:40:13 +00:00
|
|
|
<$list filter="[all[shadows+tiddlers]removeprefix<prefix>splitbefore<separator>sort[]!suffix<separator>]" variable="chunk">
|
|
|
|
<$transclude $variable="leaf-node" prefix=<<prefix>> chunk=<<chunk>> separator=<<separator>>/>
|
2017-06-28 16:44:15 +00:00
|
|
|
</$list>
|
2024-12-05 12:40:13 +00:00
|
|
|
<$list filter="[all[shadows+tiddlers]removeprefix<prefix>splitbefore<separator>sort[]suffix<separator>]" variable="chunk">
|
|
|
|
<$transclude $variable="branch-node" prefix=<<prefix>> chunk=<<chunk>> separator=<<separator>>/>
|
2017-06-28 16:44:15 +00:00
|
|
|
</$list>
|
|
|
|
</ol>
|
|
|
|
\end
|
|
|
|
|
2024-12-05 12:40:13 +00:00
|
|
|
\procedure tree(prefix: "$:/",separator: "/")
|
2017-06-28 16:44:15 +00:00
|
|
|
<div class="tc-tree">
|
2024-12-05 12:40:13 +00:00
|
|
|
<span><$text text=<<prefix>>/></span>
|
2017-06-28 16:44:15 +00:00
|
|
|
<div>
|
2024-12-05 12:40:13 +00:00
|
|
|
<$transclude $variable="tree-node" prefix=<<prefix>> separator=<<separator>>/>
|
2017-06-28 16:44:15 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
\end
|