Thanks Andreas, this is great.

Regards
Jon

On Tuesday, 3 March 2015 11:46:31 UTC, Andreas Hahn wrote:
>
>  Hi,
>
> yes that is very possible and here is how you would do it:
>
> \define toc-selective-single-expandable(tag,sort:"",itemClassFilter)
> <ol class="tc-toc toc-selective-expandable">
> <$list filter="[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$]">
> <$list filter="[all[current]toc-link[no]]" variable="ignore" 
> emptyMessage="<<toc-linked-selective-single-expandable-body tag:'$tag$' 
> sort:'$sort$' itemClassFilter:'$itemClassFilter$'>>">
> <<toc-unlinked-selective-single-expandable-body tag:"""$tag$""" 
> sort:"""$sort$""" itemClassFilter:"""$itemClassFilter$""">>
> </$list>
> </$list>
> </ol>
> \end
>
> \define 
> toc-linked-selective-single-expandable-body(tag,sort:"",itemClassFilter)
> <$set name="toc-state" value=<<qualify "$:/state/toc/$tag$">>>
> <$set name="toc-item-class" filter="""$itemClassFilter$""" 
> value="toc-item-selected" emptyValue="toc-item">
> <li class=<<toc-item-class>>>
> <$link>
> <$list filter="[all[current]tagging[]limit[1]]" variable="ignore" 
> emptyMessage="<$button 
> class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>">
> <$reveal type="nomatch" state=<<toc-state>> text=<<currentTiddler>>>
> <$button set=<<toc-state>> setTo=<<currentTiddler>> class="tc-btn-invisible">
> {{$:/core/images/right-arrow}}
> </$button>
> </$reveal>
> <$reveal type="match" state=<<toc-state>> text=<<currentTiddler>>>
> <$button set=<<toc-state>> setTo="x-all-close" class="tc-btn-invisible">
> {{$:/core/images/down-arrow}}
> </$button>
> </$reveal>
> </$list>
> <<toc-caption>>
> </$link>
> <$reveal type="match" state=<<toc-state>> text=<<currentTiddler>>>
> <$macrocall $name="toc-selective-single-expandable" tag=<<currentTiddler>> 
> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
> </$reveal>
> </li>
> </$set>
> </$set>
> \end
>
> \define 
> toc-unlinked-selective-single-expandable-body(tag,sort:"",itemClassFilter)
> <$set name="toc-state" value=<<qualify "$:/state/toc/$tag$">>>
> <$set name="toc-item-class" filter="""$itemClassFilter$""" 
> value="toc-item-selected" emptyValue="toc-item">
> <li class=<<toc-item-class>>>
> <$list filter="[all[current]tagging[]limit[1]]" variable="ignore" 
> emptyMessage="<$button 
> class='tc-btn-invisible'>{{$:/core/images/blank}}</$button> <$view 
> field='caption'><$view field='title'/></$view>">
> <$reveal type="nomatch" state=<<toc-state>> text=<<currentTiddler>>>
> <$button set=<<toc-state>> setTo=<<currentTiddler>> class="tc-btn-invisible">
> {{$:/core/images/right-arrow}}
> <<toc-caption>>
> </$button>
> </$reveal>
> <$reveal type="match" state=<<toc-state>> text=<<currentTiddler>>>
> <$button set=<<toc-state>> setTo="close" class="tc-btn-invisible">
> {{$:/core/images/down-arrow}}
> <<toc-caption>>
> </$button>
> </$reveal>
> </$list>
> <$reveal type="match" state=<<toc-state>> text=<<currentTiddler>>>
> <$macrocall $name="""toc-selective-single-expandable""" 
> tag=<<currentTiddler>> sort="""$sort$""" 
> itemClassFilter="""$itemClassFilter$"""/>
> </$reveal>
> </li>
> </$set>
> </$set>
> \end
>
> Copy and append this either in $:/core/macros/toc or make a new tiddler 
> copy this into it and tag it $:/tags/Macro. Then use it with:
>
> <<toc-selective-single-expandable 'TableOfContents'>>
>
> Alternatively you can just drag&drop the attached file and import the 
> tiddlers.
>  
> /Andreas
>
> Am 03.03.2015 um 09:23 schrieb magev958:
>  
> Hello, I was wondering if it is possible to auto-collapse open categories 
> in the TOC when you click on another.
> I have 800 *links* in 40 or 50 subcategories, making a very long list if 
> everything 
> is open 
>
> category (TOC link: no)
>    subcategory (TOC link: no)
>       sub-sub-category (TOC link: no) 
>          *link*
> -- 
> 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] <javascript:>.
> To post to this group, send email to [email protected] 
> <javascript:>.
> Visit this group at http://groups.google.com/group/tiddlywiki.
> For more options, visit https://groups.google.com/d/optout.
>
>
>  

-- 
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 http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to