Added to TW-Scripts On Wednesday, January 29, 2020 at 3:04:35 AM UTC+3:30, TonyM wrote: > > Folks, > > I have another approach, test this on TiddlyWiki.com > > Create a tiddler containing this and tag with $:/tags/ViewTemplate > \define default-toc-here() > <h4>Optional TOC here</h4> > <$list filter="[tag<currentTiddler>limit[1]]" emptyMessage="//nothing > tagged with <<currentTiddler>>//" variable=nul > > <$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>> > > </$list> > \end > <$list filter="[all[current]has:field[toc-here]]" variable=nul> > <$list filter="[all[current]get[toc-here]]" variable=toc-tiddler > emptyMessage=<<default-toc-here>> > > <h4>Optional TOC <<toc-tiddler>></h4> > <$macrocall $name="toc-selective-expandable" tag=<<toc- > tiddler>> > > </$list> > </$list> > > > - Nothing will happen right away. > - Now add the field toc-here to any tiddler and it will provide a toc > based on the current tiddler. Use new here to add items to its toc > - If however you give that field a value of tiddlername eg HelloThere > <https://tiddlywiki.com/#HelloThere> then the tiddlername will be used > as the root of the TOC > > Advantages of this approach > > - No additional tag use > - Ability to reference other parts of a TOC > > > I can see some useful enhancements, but do consider my approach as a "Code > Pattern" > > Regards > Tony > > On Tuesday, January 28, 2020 at 10:36:59 PM UTC+11, Balázs Slemmer wrote: >> >> Hi! >> >> I would like to show toc-selective-expandable after the contents of every >> tiddler that is tagged for example 'with-toc'. The root of the table of >> contents should be the current tiddler. I have tried many approaches (using >> macros, template tiddlers, etc.), but none of them seems to work. More >> precisely, they work when the root of the table of contents is a static, >> hard-coded tiddler title, but stop working when I try to use the title of >> the current tiddler. Can this be achieved? If so, how? Or is it not >> possible? >> >> Thanks! >> >
-- 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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/78d9ba87-aca2-43be-b44d-d479b7ee5910%40googlegroups.com.

