title: $:/core/macros/toc
tags: $:/tags/Macro
\define toc(tag,sort:"")
<$list filter="[tag[$tag$]$sort$]">
-
<$link>
<$view field="caption">
<$view field="title"/>
$view>
$link>
<$macrocall $name="toc" tag=<>/>
$list>
\end
\define toc-expandable-body(tag,sort:"")
<$set name="toc-state" value=<>>
<$link>
<$reveal type="nomatch" state=<> text="open">
<$button set=<> setTo="open" class="tc-btn-invisible">
{{$:/core/images/right-arrow}}
$button>
$reveal>
<$reveal type="match" state=<> text="open">
<$button set=<> setTo="close" class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
$button>
$reveal>
<$view field="caption">
<$view field="title"/>
$view>
$link>
<$reveal type="match" state=<> text="open">
<$macrocall $name="toc-expandable" tag=<> sort="$sort$"/>
$reveal>
$set>
\end
\define toc-expandable(tag,sort:"")
<$list filter="[tag[$tag$]$sort$]">
<>
$list>
\end
\define toc-selective-expandable-body(tag,sort:"")
<$set name="toc-state" value=<>>
<$link>
<$list filter="[all[current]tagging[]limit[1]]">
<$reveal type="nomatch" state=<> text="open">
<$button set=<> setTo="open" class="tc-btn-invisible">
{{$:/core/images/right-arrow}}
$button>
$reveal>
<$reveal type="match" state=<> text="open">
<$button set=<> 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=<> text="open">
<$macrocall $name="toc-selective-expandable" tag=<> sort="$sort$"/>
$reveal>
$set>
\end
\define toc-selective-expandable(tag,sort:"")
<$list filter="[tag[$tag$]$sort$]">
<>
$list>
\end