I would like to add a TOC of Sub Tiddlers (Tiddlers tagged with this Tiddler) at the end of each tiddler.
I would like to do this automatically, but only if there are Sub Tiddlers. Currently im doing it manually: I have defined a macro *t* in a Tiddler tagged with '$:/tags/Macro': \whitespace trim \define t() <hr> Sub-Tiddlers: <div class="tc-table-of-contents"> <$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>> sort="!tag[Ignore in TOCs]sort[title]"/> </div> \end And then i add <<t>> at the end of each Tiddler which has Sub Tiddlers. I would like to do this by creating a Template Tiddler *Sub Tiddlers*, which contains a call to the <<t>> macro, and adding that Template Tiddler to the list field of $:/tags/ViewTemplate. But this way the *hr* and the text 'Sub-Tiddlers:' always gets included, even if the result of the call to toc-selective-expandable is empty. Which i dont want. So either - ideally i would like to include *Sub Tiddler* only if there are Sub Tiddlers. But i have no idea how to achieve this. - or i convert <<t>> to a javascript macro (because, if i am not wrong, if/else is not possible in normal macros like the above one). Then my problem for now is, how would i call the toc-selective-expandable macro from within Javascript and how would i figure out that its result is empty? Or, where in the code base <https://github.com/Jermolene/TiddlyWiki5> is this macro defined? Any hints appreciated. -- 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 [email protected]. To post to this group, send email to [email protected]. 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/e7010e82-c5d2-4a2a-8a0c-8c8e7452a1ee%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

