Skip to content

Commit

Permalink
Extend TOC macros to use caption field
Browse files Browse the repository at this point in the history
Now the `caption` field is used for the text of each entry, if present,
falling back to the `title` field.
  • Loading branch information
Jermolene committed Aug 28, 2014
1 parent 8ca709f commit d2a5a12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions core/wiki/macros/toc.tid
Expand Up @@ -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>
Expand All @@ -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$"/>
Expand Down Expand Up @@ -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$"/>
Expand Down
4 changes: 2 additions & 2 deletions editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid
@@ -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:

Expand Down

0 comments on commit d2a5a12

Please sign in to comment.