mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-02 14:29:55 +00:00
144 lines
4.3 KiB
Plaintext
144 lines
4.3 KiB
Plaintext
title: $:/core/macros/toc
|
|
tags: $:/tags/Macro
|
|
|
|
\define toc(tag,sort:"")
|
|
<ol class="tc-toc">
|
|
<$list filter="[tag[$tag$]$sort$]">
|
|
<li>
|
|
<$list filter="[is[current]toc-link[no]]" emptyMessage="<$link><$view field='caption'><$view field='title'/></$view></$link>">
|
|
<$view field="caption">
|
|
<$view field="title"/>
|
|
</$view>
|
|
</$list>
|
|
<$macrocall $name="toc" tag=<<currentTiddler>>/>
|
|
</li>
|
|
</$list>
|
|
</ol>
|
|
\end
|
|
|
|
\define toc-linked-expandable-body(tag,sort:"")
|
|
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>>
|
|
<li>
|
|
<$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>
|
|
<$view field="caption">
|
|
<$view field="title"/>
|
|
</$view>
|
|
</$link>
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
|
<$macrocall $name="toc-expandable" tag=<<currentTiddler>> sort="$sort$"/>
|
|
</$reveal>
|
|
</li>
|
|
</$set>
|
|
\end
|
|
|
|
\define toc-unlinked-expandable-body(tag,sort:"")
|
|
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>>
|
|
<li>
|
|
<$reveal type="nomatch" state=<<toc-state>> text="open">
|
|
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible">
|
|
{{$:/core/images/right-arrow}}
|
|
<$view field="caption">
|
|
<$view field="title"/>
|
|
</$view>
|
|
</$button>
|
|
</$reveal>
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
|
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible">
|
|
{{$:/core/images/down-arrow}}
|
|
<$view field="caption">
|
|
<$view field="title"/>
|
|
</$view>
|
|
</$button>
|
|
</$reveal>
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
|
<$macrocall $name="toc-expandable" tag=<<currentTiddler>> sort="$sort$"/>
|
|
</$reveal>
|
|
</li>
|
|
</$set>
|
|
\end
|
|
|
|
\define toc-expandable(tag,sort:"")
|
|
<ol class="tc-toc toc-expandable">
|
|
<$list filter="[tag[$tag$]$sort$]">
|
|
<$list filter="[is[current]toc-link[no]]" emptyMessage="<<toc-linked-expandable-body tag:'$tag$' sort:'$sort$'>>">
|
|
<<toc-unlinked-expandable-body tag:"$tag$" sort:"$sort$">>
|
|
</$list>
|
|
</$list>
|
|
</ol>
|
|
\end
|
|
|
|
\define toc-linked-selective-expandable-body(tag,sort:"")
|
|
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>>
|
|
<li>
|
|
<$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>
|
|
<$view field="caption">
|
|
<$view field="title"/>
|
|
</$view>
|
|
</$link>
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
|
<$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>> sort="$sort$"/>
|
|
</$reveal>
|
|
</li>
|
|
</$set>
|
|
\end
|
|
|
|
\define toc-unlinked-selective-expandable-body(tag,sort:"")
|
|
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>>
|
|
<li>
|
|
<$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="open">
|
|
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible">
|
|
{{$:/core/images/right-arrow}}
|
|
<$view field="caption">
|
|
<$view field="title"/>
|
|
</$view>
|
|
</$button>
|
|
</$reveal>
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
|
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible">
|
|
{{$:/core/images/down-arrow}}
|
|
<$view field="caption">
|
|
<$view field="title"/>
|
|
</$view>
|
|
</$button>
|
|
</$reveal>
|
|
</$list>
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
|
<$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>> sort="$sort$"/>
|
|
</$reveal>
|
|
</li>
|
|
</$set>
|
|
\end
|
|
|
|
\define toc-selective-expandable(tag,sort:"")
|
|
<ol class="tc-toc toc-selective-expandable">
|
|
<$list filter="[tag[$tag$]$sort$]">
|
|
<$list filter="[is[current]toc-link[no]]" variable="ignore" emptyMessage="<<toc-linked-selective-expandable-body tag:'$tag$' sort:'$sort$'>>">
|
|
<<toc-unlinked-selective-expandable-body tag:"$tag$" sort:"$sort$">>
|
|
</$list>
|
|
</$list>
|
|
</ol>
|
|
\end
|