diff --git a/core/wiki/macros/toc.tid b/core/wiki/macros/toc.tid index 5db14fa97..fadd4ba91 100644 --- a/core/wiki/macros/toc.tid +++ b/core/wiki/macros/toc.tid @@ -1,30 +1,33 @@ title: $:/core/macros/toc tags: $:/tags/Macro -\define toc-body(rootTag,tag,sort:"") +\define toc-body(rootTag,tag,sort:"",itemClassFilter)
    <$list filter="""[tag[$tag$]!has[draft.of]$sort$]"""> -
  1. +<$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item"> +
  2. >> <$list filter="[is[current]toc-link[no]]" emptyMessage="<$link><$view field='caption'><$view field='title'/>"> <$view field="caption"> <$view field="title"/> <$list filter="""[all[current]] -[[$rootTag$]]"""> -<$macrocall $name="toc-body" rootTag="""$rootTag$""" tag=<> sort="$sort$"/> +<$macrocall $name="toc-body" rootTag="""$rootTag$""" tag=<> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
  3. +
\end -\define toc(tag,sort:"") -<> +\define toc(tag,sort:"",itemClassFilter) +<> \end -\define toc-linked-expandable-body(tag,sort:"") +\define toc-linked-expandable-body(tag,sort:"",itemClassFilter) <$set name="toc-state" value=<>> -
  • +<$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item"> +
  • >> <$link> <$reveal type="nomatch" state=<> text="open"> <$button set=<> setTo="open" class="tc-btn-invisible"> @@ -41,15 +44,17 @@ tags: $:/tags/Macro <$reveal type="match" state=<> text="open"> -<$macrocall $name="toc-expandable" tag=<> sort="$sort$"/> +<$macrocall $name="toc-expandable" tag=<> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
  • + \end -\define toc-unlinked-expandable-body(tag,sort:"") +\define toc-unlinked-expandable-body(tag,sort:"",itemClassFilter) <$set name="toc-state" value=<>> -
  • +<$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item"> +
  • >> <$reveal type="nomatch" state=<> text="open"> <$button set=<> setTo="open" class="tc-btn-invisible"> {{$:/core/images/right-arrow}} @@ -67,25 +72,27 @@ tags: $:/tags/Macro <$reveal type="match" state=<> text="open"> -<$macrocall $name="toc-expandable" tag=<> sort="$sort$"/> +<$macrocall $name="toc-expandable" tag=<> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
  • + \end -\define toc-expandable(tag,sort:"") +\define toc-expandable(tag,sort:"",itemClassFilter)
      <$list filter="[tag[$tag$]!has[draft.of]$sort$]"> -<$list filter="[is[current]toc-link[no]]" emptyMessage="<>"> -<> +<$list filter="[is[current]toc-link[no]]" emptyMessage="<>"> +<>
    \end -\define toc-linked-selective-expandable-body(tag,sort:"") +\define toc-linked-selective-expandable-body(tag,sort:"",itemClassFilter) <$set name="toc-state" value=<>> -
  • +<$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item"> +
  • >> <$link> <$list filter="[all[current]tagging[]limit[1]]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}"> <$reveal type="nomatch" state=<> text="open"> @@ -104,15 +111,17 @@ tags: $:/tags/Macro <$reveal type="match" state=<> text="open"> -<$macrocall $name="toc-selective-expandable" tag=<> sort="$sort$"/> +<$macrocall $name="toc-selective-expandable" tag=<> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
  • + \end -\define toc-unlinked-selective-expandable-body(tag,sort:"") +\define toc-unlinked-selective-expandable-body(tag,sort:"",itemClassFilter) <$set name="toc-state" value=<>> -
  • +<$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected" emptyValue="toc-item"> +
  • >> <$list filter="[all[current]tagging[]limit[1]]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}} <$view field='caption'><$view field='title'/>"> <$reveal type="nomatch" state=<> text="open"> <$button set=<> setTo="open" class="tc-btn-invisible"> @@ -132,18 +141,39 @@ tags: $:/tags/Macro <$reveal type="match" state=<> text="open"> -<$macrocall $name="toc-selective-expandable" tag=<> sort="$sort$"/> +<$macrocall $name="""toc-selective-expandable""" tag=<> sort="""$sort$""" itemClassFilter="""$itemClassFilter$"""/>
  • + \end -\define toc-selective-expandable(tag,sort:"") +\define toc-selective-expandable(tag,sort:"",itemClassFilter)
      <$list filter="[tag[$tag$]!has[draft.of]$sort$]"> -<$list filter="[is[current]toc-link[no]]" variable="ignore" emptyMessage="<>"> -<> +<$list filter="[is[current]toc-link[no]]" variable="ignore" emptyMessage="<>"> +<>
    \end + +\define toc-tabbed-selected-item-filter(selectedTiddler) +[all[current]field:title{$selectedTiddler$}] +\end + +\define toc-tabbed(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText) +<$linkcatcher to="$selectedTiddler$"> +<$tiddler tiddler={{$selectedTiddler$}}> +
    +
    +<$macrocall $name="toc-selective-expandable" tag="""$tag$""" sort="""$sort$""" itemClassFilter=<>/> +
    +
    +

    <$view field="caption"><$view field="title"/>

    +<$transclude mode="block">$unselectedText$ +
    +
    + + +\end diff --git a/editions/tw5.com/tiddlers/demonstrations/TableOfContentsMacro Tabbed Example.tid b/editions/tw5.com/tiddlers/demonstrations/TableOfContentsMacro Tabbed Example.tid new file mode 100644 index 000000000..5dc6b5ca8 --- /dev/null +++ b/editions/tw5.com/tiddlers/demonstrations/TableOfContentsMacro Tabbed Example.tid @@ -0,0 +1,9 @@ +title: TableOfContentsMacro Tabbed Example +caption: Tabbed +tags: table-of-contents-example + +!! Tabbed Table of Contents + +<$macrocall $name='wikitext-example-without-html' +src='<> +'/> diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index 0434c13cd..22e9ff2bc 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -1463,6 +1463,65 @@ a.tc-tiddlylink.tc-plugin-info:hover { font-weight: 200; } +.tc-tabbed-table-of-contents { + display: -webkit-flex; + display: flex; +} + +.tc-tabbed-table-of-contents .tc-table-of-contents { + z-index: 100; + display: inline-block; + padding-left: 1em; + max-width: 50%; + -webkit-flex: 0 0 auto; + flex: 0 0 auto; + background: <>; + border-left: 1px solid <>; + border-top: 1px solid <>; + border-bottom: 1px solid <>; +} + +.tc-tabbed-table-of-contents .tc-table-of-contents .toc-item > a, +.tc-tabbed-table-of-contents .tc-table-of-contents .toc-item-selected > a { + display: block; + padding: 0.12em 1em 0.12em 0.25em; +} + +.tc-tabbed-table-of-contents .tc-table-of-contents .toc-item > a { + border-top: 1px solid <>; + border-left: 1px solid <>; + border-bottom: 1px solid <>; +} + +.tc-tabbed-table-of-contents .tc-table-of-contents .toc-item > a:hover { + text-decoration: none; + border-top: 1px solid <>; + border-left: 1px solid <>; + border-bottom: 1px solid <>; + background: <>; +} + +.tc-tabbed-table-of-contents .tc-table-of-contents .toc-item-selected > a { + border-top: 1px solid <>; + border-left: 1px solid <>; + border-bottom: 1px solid <>; + background: <>; + margin-right: -1px; +} + +.tc-tabbed-table-of-contents .tc-table-of-contents .toc-item-selected > a:hover { + text-decoration: none; +} + +.tc-tabbed-table-of-contents .tc-tabbed-table-of-contents-content { + display: inline-block; + vertical-align: top; + padding-left: 1.5em; + border: 1px solid <>; + -webkit-flex: 1 0 50%; + flex: 1 0 50%; +} + /* ** Dirty indicator */