mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-03 17:26:56 +00:00
Remove dependency on overriding the core toc macro
Thanks to 5b38c21a417d2e5e2b85aed8010c88af32420e24 and a subsequent suggestion from @BramChen
This commit is contained in:
parent
6a8c0a25b5
commit
bf37522808
@ -1,181 +0,0 @@
|
||||
created: 20141127152047697
|
||||
modified: 20141203174852815
|
||||
tags: $:/tags/Macro
|
||||
title: $:/core/macros/toc
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define title-unless-caption()
|
||||
<$transclude field='caption'>
|
||||
<$view field='fr-title'>
|
||||
<$view field='title'/>
|
||||
</$view>
|
||||
</$transclude>
|
||||
\end
|
||||
\define toc-body(rootTag,tag,sort:"",itemClassFilter)
|
||||
<ol class="tc-toc">
|
||||
<$list filter="""[tag[$tag$]!has[draft.of]$sort$]""">
|
||||
<$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item">
|
||||
<li class=<<toc-item-class>>>
|
||||
<$list filter="[is[current]toc-link[no]]" emptyMessage="<$link><<title-unless-caption>></$link>">
|
||||
<<title-unless-caption>>
|
||||
</$list>
|
||||
<$list filter="""[all[current]] -[[$rootTag$]]""">
|
||||
<$macrocall $name="toc-body" rootTag="""$rootTag$""" tag=<<currentTiddler>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
|
||||
</$list>
|
||||
</li>
|
||||
</$set>
|
||||
</$list>
|
||||
</ol>
|
||||
\end
|
||||
|
||||
\define toc(tag,sort:"",itemClassFilter)
|
||||
<<toc-body rootTag:"""$tag$""" tag:"""$tag$""" sort:"""$sort$""" itemClassFilter:"""itemClassFilter""">>
|
||||
\end
|
||||
|
||||
\define toc-linked-expandable-body(tag,sort:"",itemClassFilter)
|
||||
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>>
|
||||
<$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item">
|
||||
<li class=<<toc-item-class>>>
|
||||
<$link>
|
||||
<$reveal type="nomatch" state=<<toc-state>> text="open">
|
||||
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible">
|
||||
{{$:/core/images/right-arrow}}
|
||||
</$button>
|
||||
</$reveal>
|
||||
<$reveal type="match" state=<<toc-state>> text="open">
|
||||
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible">
|
||||
{{$:/core/images/down-arrow}}
|
||||
</$button>
|
||||
</$reveal>
|
||||
<<title-unless-caption>>
|
||||
</$link>
|
||||
<$reveal type="match" state=<<toc-state>> text="open">
|
||||
<$macrocall $name="toc-expandable" tag=<<currentTiddler>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
|
||||
</$reveal>
|
||||
</li>
|
||||
</$set>
|
||||
</$set>
|
||||
\end
|
||||
|
||||
\define toc-unlinked-expandable-body(tag,sort:"",itemClassFilter)
|
||||
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>>
|
||||
<$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item">
|
||||
<li class=<<toc-item-class>>>
|
||||
<$reveal type="nomatch" state=<<toc-state>> text="open">
|
||||
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible">
|
||||
{{$:/core/images/right-arrow}}
|
||||
<<title-unless-caption>>
|
||||
</$button>
|
||||
</$reveal>
|
||||
<$reveal type="match" state=<<toc-state>> text="open">
|
||||
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible">
|
||||
{{$:/core/images/down-arrow}}
|
||||
<<title-unless-caption>>
|
||||
</$button>
|
||||
</$reveal>
|
||||
<$reveal type="match" state=<<toc-state>> text="open">
|
||||
<$macrocall $name="toc-expandable" tag=<<currentTiddler>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
|
||||
</$reveal>
|
||||
</li>
|
||||
</$set>
|
||||
</$set>
|
||||
\end
|
||||
|
||||
\define toc-expandable(tag,sort:"",itemClassFilter)
|
||||
<ol class="tc-toc toc-expandable">
|
||||
<$list filter="[tag[$tag$]!has[draft.of]$sort$]">
|
||||
<$list filter="[is[current]toc-link[no]]" emptyMessage="<<toc-linked-expandable-body tag:'$tag$' sort:'$sort$' itemClassFilter:'$itemClassFilter$'>>">
|
||||
<<toc-unlinked-expandable-body tag:"""$tag$""" sort:"""$sort$""" itemClassFilter:"""itemClassFilter""">>
|
||||
</$list>
|
||||
</$list>
|
||||
</ol>
|
||||
\end
|
||||
|
||||
\define toc-linked-selective-expandable-body(tag,sort:"",itemClassFilter)
|
||||
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>>
|
||||
<$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="open">
|
||||
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible">
|
||||
{{$:/core/images/right-arrow}}
|
||||
</$button>
|
||||
</$reveal>
|
||||
<$reveal type="match" state=<<toc-state>> text="open">
|
||||
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible">
|
||||
{{$:/core/images/down-arrow}}
|
||||
</$button>
|
||||
</$reveal>
|
||||
</$list>
|
||||
<<title-unless-caption>>
|
||||
</$link>
|
||||
<$reveal type="match" state=<<toc-state>> text="open">
|
||||
<$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
|
||||
</$reveal>
|
||||
</li>
|
||||
</$set>
|
||||
</$set>
|
||||
\end
|
||||
|
||||
\define toc-unlinked-selective-expandable-body(tag,sort:"",itemClassFilter)
|
||||
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>>
|
||||
<$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> <<title-unless-caption>>">
|
||||
<$reveal type="nomatch" state=<<toc-state>> text="open">
|
||||
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible">
|
||||
{{$:/core/images/right-arrow}}
|
||||
<<title-unless-caption>>
|
||||
</$button>
|
||||
</$reveal>
|
||||
<$reveal type="match" state=<<toc-state>> text="open">
|
||||
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible">
|
||||
{{$:/core/images/down-arrow}}
|
||||
<<title-unless-caption>>
|
||||
</$button>
|
||||
</$reveal>
|
||||
</$list>
|
||||
<$reveal type="match" state=<<toc-state>> text="open">
|
||||
<$macrocall $name="""toc-selective-expandable""" tag=<<currentTiddler>> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
|
||||
</$reveal>
|
||||
</li>
|
||||
</$set>
|
||||
</$set>
|
||||
\end
|
||||
|
||||
\define toc-selective-expandable(tag,sort:"",itemClassFilter)
|
||||
<ol class="tc-toc toc-selective-expandable">
|
||||
<$list filter="[tag[$tag$]!has[draft.of]$sort$]">
|
||||
<$list filter="[is[current]toc-link[no]]" variable="ignore" emptyMessage="<<toc-linked-selective-expandable-body tag:'$tag$' sort:'$sort$' itemClassFilter:'$itemClassFilter$'>>">
|
||||
<<toc-unlinked-selective-expandable-body tag:"""$tag$""" sort:"""$sort$""" itemClassFilter:"""$itemClassFilter$""">>
|
||||
</$list>
|
||||
</$list>
|
||||
</ol>
|
||||
\end
|
||||
|
||||
\define toc-tabbed-selected-item-filter(selectedTiddler)
|
||||
[all[current]field:title{$selectedTiddler$}]
|
||||
\end
|
||||
|
||||
\define toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText)
|
||||
<$tiddler tiddler={{$selectedTiddler$}}>
|
||||
<div class="tc-tabbed-table-of-contents">
|
||||
<$linkcatcher to="$selectedTiddler$">
|
||||
<div class="tc-table-of-contents">
|
||||
<$macrocall $name="toc-selective-expandable" tag="""$tag$""" sort="""$sort$""" itemClassFilter=<<toc-tabbed-selected-item-filter selectedTiddler:"""$selectedTiddler$""">>/>
|
||||
</div>
|
||||
</$linkcatcher>
|
||||
<div class="tc-tabbed-table-of-contents-content">
|
||||
<h1><<title-unless-caption>></h1>
|
||||
<$transclude mode="block">$unselectedText$</$transclude>
|
||||
</div>
|
||||
</div>
|
||||
</$tiddler>
|
||||
\end
|
||||
|
||||
\define toc-tabbed-internal-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText)
|
||||
<$linkcatcher to="""$selectedTiddler$""">
|
||||
<$macrocall $name="toc-tabbed-external-nav" tag="""$tag$""" sort="""$sort$""" selectedTiddler="""$selectedTiddler$""" unselectedText="""$unselectedText$"""/>
|
||||
</$linkcatcher>
|
||||
\end
|
@ -0,0 +1,16 @@
|
||||
created: 20141212090228728
|
||||
modified: 20141212090606825
|
||||
tags: $:/tags/Macro
|
||||
title: $:/editions/fr-FR/Macros/toc-caption
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define toc-caption()
|
||||
<$set name="tv-wikilinks" value="no">
|
||||
<$transclude field="caption">
|
||||
<$view field="fr-title">
|
||||
<$view field="title"/>
|
||||
</$view>
|
||||
</$transclude>
|
||||
</$set>
|
||||
\end
|
||||
|
Loading…
x
Reference in New Issue
Block a user