diff --git a/core/wiki/macros/toc.tid b/core/wiki/macros/toc.tid index efcdad250e7..6bfdae950a0 100644 --- a/core/wiki/macros/toc.tid +++ b/core/wiki/macros/toc.tid @@ -5,18 +5,18 @@ tags: $:/tags/Macro
    <$list filter="[tag[$tag$]$sort$]">
  1. -<$link> +<$list filter="[is[current]toc-link[no]]" emptyMessage="<$link><$view field='caption'><$view field='title'/>"> <$view field="caption"> <$view field="title"/> - + <$macrocall $name="toc" tag=<>/>
\end -\define toc-expandable-body(tag,sort:"") +\define toc-linked-expandable-body(tag,sort:"") <$set name="toc-state" value=<>>
  • <$link> @@ -41,15 +41,43 @@ tags: $:/tags/Macro \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"/> + + + +<$reveal type="match" state=<> text="open"> +<$button set=<> setTo="close" class="tc-btn-invisible"> +{{$:/core/images/down-arrow}} +<$view field="caption"> +<$view field="title"/> + + + +<$reveal type="match" state=<> text="open"> +<$macrocall $name="toc-expandable" tag=<> sort="$sort$"/> + +
  • + +\end + \define toc-expandable(tag,sort:"")
      <$list filter="[tag[$tag$]$sort$]"> -<> +<$list filter="[is[current]toc-link[no]]" emptyMessage="<>"> +<> +
    \end -\define toc-selective-expandable-body(tag,sort:"") +\define toc-linked-selective-expandable-body(tag,sort:"") <$set name="toc-state" value=<>>
  • <$link> @@ -76,10 +104,40 @@ tags: $:/tags/Macro \end +\define toc-unlinked-selective-expandable-body(tag,sort:"") +<$set name="toc-state" value=<>> +
  • +<$list filter="[all[current]tagging[]limit[1]]" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}"> +<$reveal type="nomatch" state=<> text="open"> +<$button set=<> setTo="open" class="tc-btn-invisible"> +{{$:/core/images/right-arrow}} +<$view field="caption"> +<$view field="title"/> + + + +<$reveal type="match" state=<> text="open"> +<$button set=<> setTo="close" class="tc-btn-invisible"> +{{$:/core/images/down-arrow}} +<$view field="caption"> +<$view field="title"/> + + + + +<$reveal type="match" state=<> text="open"> +<$macrocall $name="toc-selective-expandable" tag=<> sort="$sort$"/> + +
  • + +\end + \define toc-selective-expandable(tag,sort:"")
      <$list filter="[tag[$tag$]$sort$]"> -<> +<$list filter="[is[current]toc-link[no]]" emptyMessage="<>"> +<> +
    \end diff --git a/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid b/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid index 169cb8ec3f1..d82e24678ed 100644 --- a/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid +++ b/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid @@ -1,10 +1,14 @@ title: TableOfContentsMacro tags: macros -modified: 20140828080307785 +modified: 20140905084423561 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 text for each entry is taken from the ''caption'' field if it is present, otherwise the ''title'' is used. +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 of the tag tiddler as described in TiddlerTags. + +The text for each entry is taken from the ''caption'' field if it is present, otherwise the ''title'' is used. + +Entries are rendered as a link to the corresponding tiddler unless the tiddler has the value ''no'' in the field ''toc-link''. In the examples below, the entry SecondThree is set up in this way to not appear as a link. There are several variants of the macro: diff --git a/editions/tw5.com/tiddlers/samples/TableOfContents/SecondThree.tid b/editions/tw5.com/tiddlers/samples/TableOfContents/SecondThree.tid index f1b0f126893..15298faf553 100644 --- a/editions/tw5.com/tiddlers/samples/TableOfContents/SecondThree.tid +++ b/editions/tw5.com/tiddlers/samples/TableOfContents/SecondThree.tid @@ -1,5 +1,6 @@ title: SecondThree tags: Second list: SecondThreeOne SecondThreeTwo SecondThreeThree +toc-link: no Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \ No newline at end of file