2023-02-28 12:07:24 +01:00
|
|
|
created: 20230126190001604
|
|
|
|
creator: Octt
|
2023-03-01 22:32:49 +01:00
|
|
|
modified: 20230301211813834
|
2023-02-28 12:07:24 +01:00
|
|
|
modifier: Octt
|
|
|
|
tags: $:/tags/Macro
|
|
|
|
title: $:/core/macros/tree
|
|
|
|
|
|
|
|
\define leaf-link(full-title,chunk,separator: "/")
|
|
|
|
<$link to=<<__full-title__>>><$text text=<<__chunk__>>/></$link>
|
|
|
|
\end
|
|
|
|
|
|
|
|
\define leaf-node(prefix,chunk)
|
|
|
|
\whitespace trim
|
|
|
|
<li>
|
|
|
|
<$list filter="[<__prefix__>addsuffix<__chunk__>is[shadow]] [<__prefix__>addsuffix<__chunk__>is[tiddler]]" variable="full-title">
|
|
|
|
<$list filter="[<full-title>removeprefix<__prefix__>]" variable="chunk">
|
|
|
|
<span>{{$:/core/images/file}}</span> <$macrocall $name="leaf-link" full-title=<<full-title>> chunk=<<chunk>>/>
|
|
|
|
</$list>
|
|
|
|
</$list>
|
|
|
|
</li>
|
|
|
|
\end
|
|
|
|
|
|
|
|
\define branch-node(prefix,chunk,separator: "/")
|
|
|
|
\whitespace trim
|
|
|
|
<li>
|
|
|
|
<$set name="reveal-state" value={{{ [[$:/state/tree/]addsuffix<__prefix__>addsuffix<__chunk__>] }}}>
|
|
|
|
<$reveal type="nomatch" stateTitle=<<reveal-state>> text="show">
|
|
|
|
<$button setTitle=<<reveal-state>> setTo="show" class="tc-btn-invisible">
|
|
|
|
{{$:/core/images/folder}} <$text text=<<__chunk__>>/>
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
<$reveal type="match" stateTitle=<<reveal-state>> text="show">
|
|
|
|
<$button setTitle=<<reveal-state>> setTo="hide" class="tc-btn-invisible">
|
|
|
|
{{$:/core/images/folder}} <$text text=<<__chunk__>>/>
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
 
|
|
|
|
<span>(<$count filter="[all[shadows+tiddlers]removeprefix<__prefix__>removeprefix<__chunk__>] -[<__prefix__>addsuffix<__chunk__>]"/>)</span>
|
|
|
|
<$reveal type="match" stateTitle=<<reveal-state>> text="show">
|
|
|
|
<$macrocall $name="tree-node" prefix={{{ [<__prefix__>addsuffix<__chunk__>] }}} separator=<<__separator__>>/>
|
|
|
|
</$reveal>
|
|
|
|
</$set>
|
|
|
|
</li>
|
|
|
|
\end
|
|
|
|
|
|
|
|
\define tree-node(prefix,separator: "/")
|
|
|
|
\whitespace trim
|
|
|
|
<ol>
|
|
|
|
<$list filter="[all[shadows+tiddlers]removeprefix<__prefix__>splitbefore<__separator__>sort[]!suffix<__separator__>]" variable="chunk">
|
|
|
|
<$macrocall $name="leaf-node" prefix=<<__prefix__>> chunk=<<chunk>> 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>
|
|
|
|
</ol>
|
|
|
|
\end
|
|
|
|
|
2023-03-01 22:32:49 +01:00
|
|
|
<!-- Below was edited from original -->
|
|
|
|
|
|
|
|
\define tree-show-title-true(prefix) <span><$text text=<<__prefix__>>/></span>
|
|
|
|
|
|
|
|
\define tree_(prefix:"", separator:"/", show-title:"true")
|
2023-02-28 12:07:24 +01:00
|
|
|
\whitespace trim
|
|
|
|
<div class="tc-tree">
|
2023-03-01 22:32:49 +01:00
|
|
|
<$macrocall $name="tree-show-title-$show-title$" prefix=<<__prefix__>> />
|
|
|
|
<div>
|
|
|
|
<$macrocall $name="tree-node" prefix=<<__prefix__>> separator=<<__separator__>>/>
|
|
|
|
</div>
|
2023-02-28 12:07:24 +01:00
|
|
|
</div>
|
|
|
|
\end
|
|
|
|
|
|
|
|
\define tree(prefix:"$:/", separator:"/") <$macrocall $name="tree_" prefix=<<__prefix__>> separator=<<__separator__>>/>
|