1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-18 11:29:55 +00:00

Fix problem with recursion in table of contents macro

Fixes #1036
This commit is contained in:
Jermolene 2014-11-02 21:03:27 +00:00
parent 835e3a9452
commit 3d7b40fbaa

View File

@ -1,21 +1,31 @@
title: $:/core/macros/toc
tags: $:/tags/Macro
\define toc(tag,sort:"")
\define toc-body(rootTag,tag,sort:"")
<ol class="tc-toc">
<$list filter="[tag[$tag$]$sort$]">
<$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>> sort="$sort$"/>
<$list filter="""[all[current]] -[[$rootTag$]]""">
<$macrocall $name="toc-body" rootTag="""$rootTag$""" tag=<<currentTiddler>> sort="$sort$"/>
</$list>
</li>
</$list>
</ol>
\end
\define toc(tag,sort:"")
<<toc-body rootTag:"""$tag$""" tag:"""$tag$""" sort:"""$sort$""">>
\end
\define toc-linked-expandable-body(tag,sort:"")
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>>
<li>