1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 17:10:29 +00:00

Extend TOC macros to use caption field

Now the `caption` field is used for the text of each entry, if present,
falling back to the `title` field.
This commit is contained in:
Jermolene 2014-08-28 08:58:53 +01:00
parent 8ca709f664
commit d2a5a12f2d
2 changed files with 8 additions and 2 deletions

View File

@ -6,7 +6,9 @@ tags: $:/tags/Macro
<$list filter="[tag[$tag$]$sort$]">
<li>
<$link>
<$view field="caption">
<$view field="title"/>
</$view>
</$link>
<$macrocall $name="toc" tag=<<currentTiddler>>/>
</li>
@ -28,7 +30,9 @@ tags: $:/tags/Macro
{{$:/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$"/>
@ -61,7 +65,9 @@ tags: $:/tags/Macro
</$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$"/>

View File

@ -1,10 +1,10 @@
title: TableOfContentsMacro
tags: macros
modified: 20140818180307785
modified: 20140828080307785
The table of contents macro produces a hierarchical tree of tiddlers based on their tags.
The top level entries of the table of contents are defined by a root tag. The subentries under each of those entries are tagged with the title of the entry. Entries can be ordered using the `list` field as described in TiddlerTags.
The top level entries of the table of contents are defined by a root tag. The subentries under each of those entries are tagged with the title of the entry. Entries can be ordered using the `list` field as described in TiddlerTags. The text for each entry is taken from the ''caption'' field if it is present, otherwise the ''title'' is used.
There are several variants of the macro: