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