Rather than Provide a link to each tiddler in our toc we can use a tag pill 
on the current tiddler.

You can use a tag pill to drag and drop the order of items so tagged;

Here I only changed the second line in the previous example.

\define each-other-level(filter)
<li><$macrocall $name=tag tag=<<currentTiddler>>/></li>
<ul>
<$list filter="$filter$">
   <<each-other-level $filter$>>
</$list>
</ul>
\end
\define first-level(filter)
<ul>
<$list filter="$filter$">
   <<each-other-level $filter$>>
</$list>
</ul>
\end


Start in TableOfContents<br>
<$tiddler tiddler="TableOfContents">


<<first-level "[is[current]tagging[]]">>


</$tiddler>


On Saturday, January 18, 2020 at 1:09:22 PM UTC+11, TonyM wrote:
>
> Folks,
>
> We see a range of requests to customise the Table Of Contents macros such 
> as here 
> <https://groups.google.com/forum/?hl=en#!topic/tiddlywiki/c26Ovb5ivdA> to 
> colour items. Often we try and address each of these bespoke requests using 
> the existing TOC macros. This perhaps because the nature of a TOC is a 
> little less intuitive than most. It requires a Recursive 
> <https://en.wikipedia.org/wiki/Recursion> process. I thought I would 
> share some details on this recursive code pattern and invite others to 
> produce additional features, ideally based on those prior so people can 
> learn from them.
>
> The Following examples work if placed in a single tiddler on TiddlyWiki.com
>
> \define each-other-level(filter)
> <li><$link to=<<currentTiddler>> ><$text 
> text=<<currentTiddler>>/></$link></li>
> <ul>
> <$list filter="$filter$">
>    <<each-other-level $filter$>>
> </$list>
> </ul>
> \end
> \define first-level(filter)
> <ul>
> <$list filter="$filter$">
>    <<each-other-level $filter$>>
> </$list>
> </ul>
> \end
>
> Start in TableOfContents<br>
> <$tiddler tiddler="TableOfContents">
>
> <<first-level "[is[current]tagging[]]">>
>
> </$tiddler>
>
>
> See how the at the bottom we start calling the first-level macro, then this 
> calls each-other-level for each item in the list.
>
>
> The recursion then occurs when inside *each-other-**level* we call 
> *each-other-level*
>
>
> Not how the list is wrapped in `<ul>` and each line with `<li>` this makes 
> use of HTML to generate lists and will nest them.
>
>
> Soon I will post a more advanced version with Notes.
>
>
> Regards
>
> Tony
>
>
>

-- 
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/3143026c-4827-4623-83d4-bc736db20aa1%40googlegroups.com.

Reply via email to