2014-08-18 19:52:36 +00:00
|
|
|
title: $:/core/macros/toc
|
|
|
|
tags: $:/tags/Macro
|
|
|
|
|
2022-11-14 22:04:30 +00:00
|
|
|
|
|
|
|
\define toc-open-icon() $:/core/images/down-arrow
|
|
|
|
\define toc-closed-icon() $:/core/images/right-arrow
|
|
|
|
|
2014-12-11 17:00:57 +00:00
|
|
|
\define toc-caption()
|
2022-04-01 11:09:59 +00:00
|
|
|
\whitespace trim
|
2023-07-22 11:41:19 +00:00
|
|
|
<span class="tc-toc-caption tc-tiny-gap-left">
|
2014-12-11 17:00:57 +00:00
|
|
|
<$set name="tv-wikilinks" value="no">
|
2016-12-17 15:29:03 +00:00
|
|
|
<$transclude field="caption">
|
|
|
|
<$view field="title"/>
|
|
|
|
</$transclude>
|
2014-12-11 17:00:57 +00:00
|
|
|
</$set>
|
2022-07-28 16:02:14 +00:00
|
|
|
</span>
|
2014-12-11 17:00:57 +00:00
|
|
|
\end
|
|
|
|
|
2016-12-17 15:29:03 +00:00
|
|
|
\define toc-body(tag,sort:"",itemClassFilter,exclude,path)
|
2022-04-01 11:09:59 +00:00
|
|
|
\whitespace trim
|
2014-08-31 13:05:43 +00:00
|
|
|
<ol class="tc-toc">
|
2023-06-13 09:44:34 +00:00
|
|
|
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
2022-04-01 11:09:59 +00:00
|
|
|
<$let item=<<currentTiddler>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
2023-06-13 09:44:34 +00:00
|
|
|
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
2019-07-15 11:31:50 +00:00
|
|
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
2019-03-27 14:59:38 +00:00
|
|
|
<li class=<<toc-item-class>>>
|
2023-01-19 17:46:50 +00:00
|
|
|
<$list filter="[all[current]toc-link[no]]" emptyMessage="<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}><<toc-caption>></$link>">
|
2019-03-27 14:59:38 +00:00
|
|
|
<<toc-caption>>
|
|
|
|
</$list>
|
|
|
|
<$macrocall $name="toc-body" tag=<<item>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>>/>
|
|
|
|
</li>
|
|
|
|
</$set>
|
2016-12-17 15:29:03 +00:00
|
|
|
</$set>
|
2022-04-01 11:09:59 +00:00
|
|
|
</$let>
|
2016-12-17 15:29:03 +00:00
|
|
|
</$list>
|
2014-08-18 19:52:36 +00:00
|
|
|
</ol>
|
|
|
|
\end
|
|
|
|
|
2023-06-13 09:44:34 +00:00
|
|
|
\define toc(tag,sort:"",itemClassFilter:"", exclude)
|
2024-10-24 16:39:18 +00:00
|
|
|
\whitespace trim
|
|
|
|
<$let __tag__={{{ [<__tag__>is[blank]then<currentTiddler>else<__tag__>] }}} >
|
|
|
|
<$macrocall $name="toc-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>>/>
|
|
|
|
</$let>
|
2014-11-02 21:03:27 +00:00
|
|
|
\end
|
|
|
|
|
2019-03-30 12:10:42 +00:00
|
|
|
\define toc-linked-expandable-body(tag,sort:"",itemClassFilter,exclude,path)
|
2022-04-01 11:09:59 +00:00
|
|
|
\whitespace trim
|
2016-12-17 15:29:03 +00:00
|
|
|
<!-- helper function -->
|
2018-11-06 16:41:18 +00:00
|
|
|
<$qualify name="toc-state" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>
|
2019-07-15 11:31:50 +00:00
|
|
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
2016-12-17 15:29:03 +00:00
|
|
|
<li class=<<toc-item-class>>>
|
2020-10-17 12:44:15 +00:00
|
|
|
<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}>
|
2018-11-18 10:54:12 +00:00
|
|
|
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
|
|
|
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
2022-11-14 22:04:30 +00:00
|
|
|
<$transclude tiddler=<<toc-closed-icon>> />
|
2016-12-17 15:29:03 +00:00
|
|
|
</$button>
|
|
|
|
</$reveal>
|
2018-11-18 10:54:12 +00:00
|
|
|
<$reveal type="match" stateTitle=<<toc-state>> text="open">
|
|
|
|
<$button setTitle=<<toc-state>> setTo="close" class="tc-btn-invisible tc-popup-keep">
|
2022-11-14 22:04:30 +00:00
|
|
|
<$transclude tiddler=<<toc-open-icon>> />
|
2016-12-17 15:29:03 +00:00
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
<<toc-caption>>
|
|
|
|
</$link>
|
2018-11-18 10:54:12 +00:00
|
|
|
<$reveal type="match" stateTitle=<<toc-state>> text="open">
|
2019-03-30 12:10:42 +00:00
|
|
|
<$macrocall $name="toc-expandable" tag=<<currentTiddler>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>> path=<<__path__>>/>
|
2016-12-17 15:29:03 +00:00
|
|
|
</$reveal>
|
|
|
|
</li>
|
|
|
|
</$set>
|
2018-11-06 15:29:13 +00:00
|
|
|
</$qualify>
|
2014-08-18 19:52:36 +00:00
|
|
|
\end
|
|
|
|
|
2019-07-15 11:31:50 +00:00
|
|
|
\define toc-unlinked-expandable-body(tag,sort:"",itemClassFilter,exclude,path)
|
2022-04-01 11:09:59 +00:00
|
|
|
\whitespace trim
|
2016-12-17 15:29:03 +00:00
|
|
|
<!-- helper function -->
|
2018-11-06 16:41:18 +00:00
|
|
|
<$qualify name="toc-state" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>
|
2019-07-15 11:31:50 +00:00
|
|
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
2016-12-17 15:29:03 +00:00
|
|
|
<li class=<<toc-item-class>>>
|
2018-11-18 10:54:12 +00:00
|
|
|
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
|
|
|
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
2023-06-13 09:44:34 +00:00
|
|
|
<$transclude tiddler=<<toc-closed-icon>> />
|
2016-12-17 15:29:03 +00:00
|
|
|
<<toc-caption>>
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
2018-11-18 10:54:12 +00:00
|
|
|
<$reveal type="match" stateTitle=<<toc-state>> text="open">
|
|
|
|
<$button setTitle=<<toc-state>> setTo="close" class="tc-btn-invisible tc-popup-keep">
|
2022-11-14 22:04:30 +00:00
|
|
|
<$transclude tiddler=<<toc-open-icon>> />
|
2016-12-17 15:29:03 +00:00
|
|
|
<<toc-caption>>
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
2018-11-18 10:54:12 +00:00
|
|
|
<$reveal type="match" stateTitle=<<toc-state>> text="open">
|
2019-03-30 12:10:42 +00:00
|
|
|
<$macrocall $name="toc-expandable" tag=<<currentTiddler>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>> path=<<__path__>>/>
|
2016-12-17 15:29:03 +00:00
|
|
|
</$reveal>
|
|
|
|
</li>
|
|
|
|
</$set>
|
2018-11-06 15:29:13 +00:00
|
|
|
</$qualify>
|
2014-09-05 08:49:10 +00:00
|
|
|
\end
|
|
|
|
|
2016-05-02 07:20:04 +00:00
|
|
|
\define toc-expandable-empty-message()
|
2019-03-30 12:10:42 +00:00
|
|
|
<$macrocall $name="toc-linked-expandable-body" tag=<<tag>> sort=<<sort>> itemClassFilter=<<itemClassFilter>> exclude=<<excluded>> path=<<path>>/>
|
2016-05-02 07:20:04 +00:00
|
|
|
\end
|
|
|
|
|
2019-08-31 14:00:34 +00:00
|
|
|
\define toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path)
|
2022-04-01 11:09:59 +00:00
|
|
|
\whitespace trim
|
2024-10-24 16:39:18 +00:00
|
|
|
<$let __tag__={{{ [<__tag__>is[blank]then<currentTiddler>else<__tag__>] }}} tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
2023-06-13 09:44:34 +00:00
|
|
|
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
2019-03-30 12:10:42 +00:00
|
|
|
<ol class="tc-toc toc-expandable">
|
2023-06-13 09:44:34 +00:00
|
|
|
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
2019-03-30 12:10:42 +00:00
|
|
|
<$list filter="[all[current]toc-link[no]]" emptyMessage=<<toc-expandable-empty-message>> >
|
|
|
|
<$macrocall $name="toc-unlinked-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="""itemClassFilter""" exclude=<<excluded>> path=<<path>> />
|
|
|
|
</$list>
|
2016-12-17 15:29:03 +00:00
|
|
|
</$list>
|
2019-03-30 12:10:42 +00:00
|
|
|
</ol>
|
|
|
|
</$set>
|
2022-04-01 11:09:59 +00:00
|
|
|
</$let>
|
2014-08-19 11:30:22 +00:00
|
|
|
\end
|
|
|
|
|
2019-07-15 11:31:50 +00:00
|
|
|
\define toc-linked-selective-expandable-body(tag,sort:"",itemClassFilter,exclude,path)
|
2022-04-01 11:09:59 +00:00
|
|
|
\whitespace trim
|
2018-11-06 16:41:18 +00:00
|
|
|
<$qualify name="toc-state" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>
|
2019-07-15 11:31:50 +00:00
|
|
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item" >
|
2016-12-17 15:29:03 +00:00
|
|
|
<li class=<<toc-item-class>>>
|
2020-10-17 12:44:15 +00:00
|
|
|
<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}>
|
2023-10-25 12:37:24 +00:00
|
|
|
<$list filter="[all[current]tagging[]$sort$limit[1]] -[subfilter<__exclude__>]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>">
|
2018-11-18 10:54:12 +00:00
|
|
|
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
|
|
|
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
2022-11-14 22:04:30 +00:00
|
|
|
<$transclude tiddler=<<toc-closed-icon>> />
|
2016-12-17 15:29:03 +00:00
|
|
|
</$button>
|
|
|
|
</$reveal>
|
2018-11-18 10:54:12 +00:00
|
|
|
<$reveal type="match" stateTitle=<<toc-state>> text="open">
|
|
|
|
<$button setTitle=<<toc-state>> setTo="close" class="tc-btn-invisible tc-popup-keep">
|
2022-11-14 22:04:30 +00:00
|
|
|
<$transclude tiddler=<<toc-open-icon>> />
|
2016-12-17 15:29:03 +00:00
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
</$list>
|
|
|
|
<<toc-caption>>
|
|
|
|
</$link>
|
2018-11-18 10:54:12 +00:00
|
|
|
<$reveal type="match" stateTitle=<<toc-state>> text="open">
|
2019-03-30 12:10:42 +00:00
|
|
|
<$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>> path=<<__path__>>/>
|
2016-12-17 15:29:03 +00:00
|
|
|
</$reveal>
|
|
|
|
</li>
|
|
|
|
</$set>
|
2018-11-06 15:29:13 +00:00
|
|
|
</$qualify>
|
2014-08-19 11:30:22 +00:00
|
|
|
\end
|
|
|
|
|
2019-07-15 11:31:50 +00:00
|
|
|
\define toc-unlinked-selective-expandable-body(tag,sort:"",itemClassFilter,exclude,path)
|
2022-04-01 11:09:59 +00:00
|
|
|
\whitespace trim
|
2018-11-06 16:41:18 +00:00
|
|
|
<$qualify name="toc-state" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}}>
|
2019-07-15 11:31:50 +00:00
|
|
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item-selected" value="toc-item">
|
2016-12-17 15:29:03 +00:00
|
|
|
<li class=<<toc-item-class>>>
|
2023-10-25 12:37:24 +00:00
|
|
|
<$list filter="[all[current]tagging[]$sort$limit[1]] -[subfilter<__exclude__>]" variable="ignore" emptyMessage="""<$button class="tc-btn-invisible">{{$:/core/images/blank}}</$button><span class="toc-item-muted"><<toc-caption>></span>""">
|
2018-11-18 10:54:12 +00:00
|
|
|
<$reveal type="nomatch" stateTitle=<<toc-state>> text="open">
|
|
|
|
<$button setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
2022-11-14 22:04:30 +00:00
|
|
|
<$transclude tiddler=<<toc-closed-icon>> />
|
2016-12-17 15:29:03 +00:00
|
|
|
<<toc-caption>>
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
2018-11-18 10:54:12 +00:00
|
|
|
<$reveal type="match" stateTitle=<<toc-state>> text="open">
|
|
|
|
<$button setTitle=<<toc-state>> setTo="close" class="tc-btn-invisible tc-popup-keep">
|
2022-11-14 22:04:30 +00:00
|
|
|
<$transclude tiddler=<<toc-open-icon>> />
|
2016-12-17 15:29:03 +00:00
|
|
|
<<toc-caption>>
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
</$list>
|
2018-11-18 10:54:12 +00:00
|
|
|
<$reveal type="match" stateTitle=<<toc-state>> text="open">
|
2019-03-30 12:10:42 +00:00
|
|
|
<$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>> path=<<__path__>>/>
|
2016-12-17 15:29:03 +00:00
|
|
|
</$reveal>
|
|
|
|
</li>
|
|
|
|
</$set>
|
2018-11-06 15:29:13 +00:00
|
|
|
</$qualify>
|
2014-09-05 08:49:10 +00:00
|
|
|
\end
|
|
|
|
|
2016-05-02 07:20:04 +00:00
|
|
|
\define toc-selective-expandable-empty-message()
|
2019-03-30 12:10:42 +00:00
|
|
|
<$macrocall $name="toc-linked-selective-expandable-body" tag=<<tag>> sort=<<sort>> itemClassFilter=<<itemClassFilter>> exclude=<<excluded>> path=<<path>>/>
|
2016-05-02 07:20:04 +00:00
|
|
|
\end
|
|
|
|
|
2019-03-30 12:10:42 +00:00
|
|
|
\define toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path)
|
2022-04-01 11:09:59 +00:00
|
|
|
\whitespace trim
|
2024-10-24 16:39:18 +00:00
|
|
|
<$let __tag__={{{ [<__tag__>is[blank]then<currentTiddler>else<__tag__>] }}} tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
2023-06-13 09:44:34 +00:00
|
|
|
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
2019-03-30 12:10:42 +00:00
|
|
|
<ol class="tc-toc toc-selective-expandable">
|
2023-06-13 09:44:34 +00:00
|
|
|
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
2019-03-30 12:10:42 +00:00
|
|
|
<$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage=<<toc-selective-expandable-empty-message>> >
|
|
|
|
<$macrocall $name="toc-unlinked-selective-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>>/>
|
|
|
|
</$list>
|
2016-12-17 15:29:03 +00:00
|
|
|
</$list>
|
2019-03-30 12:10:42 +00:00
|
|
|
</ol>
|
|
|
|
</$set>
|
2022-04-01 11:09:59 +00:00
|
|
|
</$let>
|
2014-08-18 19:52:36 +00:00
|
|
|
\end
|
2014-11-13 21:39:28 +00:00
|
|
|
|
2023-06-13 09:44:34 +00:00
|
|
|
\define toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude)
|
2022-04-01 11:09:59 +00:00
|
|
|
\whitespace trim
|
2024-10-24 16:39:18 +00:00
|
|
|
<$let __tag__={{{ [<__tag__>is[blank]then<currentTiddler>else<__tag__>] }}}>
|
|
|
|
<$tiddler tiddler={{{ [<__selectedTiddler__>get[text]] }}}>
|
|
|
|
<div class="tc-tabbed-table-of-contents">
|
|
|
|
<$linkcatcher to=<<__selectedTiddler__>>>
|
|
|
|
<div class="tc-table-of-contents">
|
|
|
|
<$macrocall $name="toc-selective-expandable" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="[all[current]] -[<__selectedTiddler__>get[text]]" exclude=<<__exclude__>>/>
|
|
|
|
</div>
|
|
|
|
</$linkcatcher>
|
|
|
|
<div class="tc-tabbed-table-of-contents-content">
|
|
|
|
<$reveal stateTitle=<<__selectedTiddler__>> type="nomatch" text="">
|
|
|
|
<$transclude mode="block" tiddler=<<__template__>>>
|
|
|
|
<h1><<toc-caption>></h1>
|
|
|
|
<$transclude mode="block">$missingText$</$transclude>
|
|
|
|
</$transclude>
|
|
|
|
</$reveal>
|
|
|
|
<$reveal stateTitle=<<__selectedTiddler__>> type="match" text="">
|
|
|
|
$unselectedText$
|
|
|
|
</$reveal>
|
2016-12-17 15:29:03 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-10-24 16:39:18 +00:00
|
|
|
</$tiddler>
|
|
|
|
</$let>
|
2014-11-14 17:06:21 +00:00
|
|
|
\end
|
|
|
|
|
2023-06-13 09:44:34 +00:00
|
|
|
\define toc-tabbed-internal-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude)
|
2022-04-01 11:09:59 +00:00
|
|
|
\whitespace trim
|
2024-10-24 16:39:18 +00:00
|
|
|
<$let __tag__={{{ [<__tag__>is[blank]then<currentTiddler>else<__tag__>] }}}>
|
|
|
|
<$linkcatcher to=<<__selectedTiddler__>>>
|
|
|
|
<$macrocall $name="toc-tabbed-external-nav" tag=<<__tag__>> sort=<<__sort__>> selectedTiddler=<<__selectedTiddler__>> unselectedText=<<__unselectedText__>> missingText=<<__missingText__>> template=<<__template__>> exclude=<<__exclude__>> />
|
|
|
|
</$linkcatcher>
|
|
|
|
</$let>
|
2014-11-13 21:39:28 +00:00
|
|
|
\end
|