Andrej,

Good work, 

I was about to reply with the basic "recursion" approach, where the macro 
calls itself, importantly from inside a list widget, so it is limited to 
the set of members in that lists filter. I think a lot of people leave this 
behaviour to toc macros when you can build it yourself once you understand 
the pattern.

That is the macro will work its way through all members of that 
hierarchical list, down branches to the leaves, once the leaf siblings are 
all listed it returns to the previous level....

In side the list other than calling the macro you can place anything you 
want to take place on every item in the hierarchy.  

Regards
Tony


On Friday, July 13, 2018 at 8:25:10 PM UTC+10, Andrej Korenić wrote:
>
> Well, I got it working... I don't know how but here is the solution...
>
> I created tiddler called Transclude chapters that was tagged with 
> $:/tags/Macro. Code is this:
>
> \define transclude_chapters(tag,sort:"",itemClassFilter,exclude,path)
>
>   <$list filter="""[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$] 
> -[[$tag$]] $exclude$""">
>     <$vars item=<<currentTiddler>> path="""$path$/$tag$""" 
> excluded="""$exclude$ 
> -[[$tag$]]""">
>       <$set name="toc-item-class" filter="""$itemClassFilter$""" 
> emptyValue="toc-item" value="toc-item-selected">
>
>         <$transclude mode='block'/>
>
>          <$macrocall $name="transclude_chapters" tag=<<item>> sort=
> """$sort$""" itemClassFilter="""$itemClassFilter$""" exclude=<<excluded>> 
> path=<<path>>/>
>
>       </$set>
>     </$vars>
>   </$list>
> \end
>
> So I just call it with the root tag:
>
> <<transclude_chapters "Table of Contents">>
>
> and that's it :)
>

-- 
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/e36b4c20-b24a-42cd-80f2-cd54592c8db7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to