Ok - I see. My tiddlers don't have a "/" in any of their names so that explains it. A couple more questions now. What does the "chunk" parameter do?
Also, would it be terribly difficult to modify the macro to list the folders first and also not to exclude the prefix from the listed tiddler names?
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/a4176b59-2239-4c8b-a5cf-fbdeeb722e53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
As it turns out, I suspect it’s not wildly useful beyond the system tiddlers. Given the following data tiddlers:
Great Expectations-Vol 1-Chapter 1-Para 1
Great Expectations-Vol 2-Chapter 52-Para 135
... The output is ...
all[shadows+tiddlers]
\define leaf-link2(full-title,chunk,separator: "/")
<$link to=<<__full-title__>>><$text text=<<__chunk__>>/></$link>
\end
\define leaf-node2(prefix,chunk)
<li>
<$list filter="[<__prefix__>addsuffix<__chunk__>]" variable="full-title">
<$list filter="[description<full-title>is[shadow]] [description<full-title>is[tiddler]]" variable="dummy">
<$list filter="[<full-title>removeprefix<__prefix__>]" variable="chunk">
<span>{{$:/core/images/file}}</span> <$macrocall $name="leaf-link2" full-title=<<full-title>> chunk=<<chunk>>/>
</$list>
</$list>
</$list>
</li>
\end
\define branch-node2(prefix,chunk,separator: "/")
<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]each[description]get[description]removeprefix<__prefix__>removeprefix<__chunk__>] -[<__prefix__>addsuffix<__chunk__>]"/>)</span>
<$reveal type="match" stateTitle=<<reveal-state>> text="show">
<$macrocall $name="tree-node2" prefix={{{ [<__prefix__>addsuffix<__chunk__>] }}} separator=<<__separator__>>/>
</$reveal>
</$set>
</li>
\end
\define tree-node2(prefix,separator: "/")
<ol>
<$list filter="[all[shadows+tiddlers]each[description]get[description]removeprefix<__prefix__>splitbefore<__separator__>sort[]!suffix<__separator__>]" variable="chunk">
<$macrocall $name="leaf-node2" prefix=<<__prefix__>> chunk=<<chunk>> separator=<<__separator__>>/>
</$list>
<$list filter="[all[shadows+tiddlers]each[description]get[description]removeprefix<__prefix__>splitbefore<__separator__>sort[]suffix<__separator__>]" variable="chunk">
<$macrocall $name="branch-node2" prefix=<<__prefix__>> chunk=<<chunk>> separator=<<__separator__>>/>
</$list>
</ol>
\end
\define tree2(prefix: "$:/",separator: "/")
<div class="tc-tree">
<span><$text text=<<__prefix__>>/></span>
<div>
<$macrocall $name="tree-node2" prefix=<<__prefix__>> separator=<<__separator__>>/>
</div>
</div>
\end
After playing around with this new macro further, I've found that it only works as long as the description matches the tiddler title exactly. If not, then there is an entry in the tree list to a tiddler that doesn't exist. What tweak could I make that would fix this?
I suspect it’s not wildly useful beyond the system tiddlers
Some useful use-cases, maybe not wildly so...
If I call <<tree prefix:"2019" separator:"-">> I get
a tree of my journal tiddlers; nice.
It might be wildly useful in Biology: I want to inventorise my aquarium using latin nomenclature, where I have a fish named "Pisces Botiidae Cypriniformes Osteichthyes Botiidae Botiini Leptobotia curta"
I call the macro with : <<tree prefix:"Pisces" separator:" ">>
One might argue that a relational Access databse can achieve the same, but it could not, in the same file, deal with entries like "unknown red fish" "decorative white stone" Task: clean the glass"
On top: If I enter one fish, all higher levels of the systemic
nomenclature are displayed in the tree
_________________________________________________________________ ________________________________________________________ Ihre E-Mail-Postfächer sicher & zentral an einem Ort. Jetzt wechseln und alte E-Mail-Adresse mitnehmen! https://www.eclipso.de