2014-08-18 19:52:36 +00:00
|
|
|
title: $:/core/macros/toc
|
|
|
|
tags: $:/tags/Macro
|
|
|
|
|
2014-12-11 17:00:57 +00:00
|
|
|
\define toc-caption()
|
|
|
|
<$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>
|
|
|
|
\end
|
|
|
|
|
2016-12-17 15:29:03 +00:00
|
|
|
\define toc-body(tag,sort:"",itemClassFilter,exclude,path)
|
2014-08-31 13:05:43 +00:00
|
|
|
<ol class="tc-toc">
|
2018-09-11 12:02:28 +00:00
|
|
|
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
|
|
|
|
<$vars item=<<currentTiddler>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}} excluded="""[enlist<__exclude__>] -[<__tag__>]""">
|
2018-09-10 11:56:38 +00:00
|
|
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item" value="toc-item-selected">
|
2016-12-17 15:29:03 +00:00
|
|
|
<li class=<<toc-item-class>>>
|
|
|
|
<$list filter="[all[current]toc-link[no]]" emptyMessage="<$link><$view field='caption'><$view field='title'/></$view></$link>">
|
|
|
|
<<toc-caption>>
|
|
|
|
</$list>
|
2018-09-10 11:56:38 +00:00
|
|
|
<$macrocall $name="toc-body" tag=<<item>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>>/>
|
2016-12-17 15:29:03 +00:00
|
|
|
</li>
|
|
|
|
</$set>
|
|
|
|
</$vars>
|
|
|
|
</$list>
|
2014-08-18 19:52:36 +00:00
|
|
|
</ol>
|
|
|
|
\end
|
|
|
|
|
2016-12-17 15:29:03 +00:00
|
|
|
\define toc(tag,sort:"",itemClassFilter:" ")
|
2018-09-10 11:56:38 +00:00
|
|
|
<$macrocall $name="toc-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> />
|
2014-11-02 21:03:27 +00:00
|
|
|
\end
|
|
|
|
|
2016-12-17 15:29:03 +00:00
|
|
|
\define toc-linked-expandable-body(tag,sort:"",itemClassFilter,exclude,path)
|
|
|
|
<!-- helper function -->
|
2018-09-10 11:56:38 +00:00
|
|
|
<$wikify name="toc-state" text="""
|
|
|
|
<$macrocall $name="qualify" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}} />
|
|
|
|
""">
|
|
|
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item" value="toc-item-selected">
|
2016-12-17 15:29:03 +00:00
|
|
|
<li class=<<toc-item-class>>>
|
|
|
|
<$link>
|
|
|
|
<$reveal type="nomatch" state=<<toc-state>> text="open">
|
2018-02-21 14:44:10 +00:00
|
|
|
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
2016-12-17 15:29:03 +00:00
|
|
|
{{$:/core/images/right-arrow}}
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
2018-02-21 14:44:10 +00:00
|
|
|
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible tc-popup-keep">
|
2016-12-17 15:29:03 +00:00
|
|
|
{{$:/core/images/down-arrow}}
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
<<toc-caption>>
|
|
|
|
</$link>
|
|
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
2018-09-10 11:56:38 +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-09-10 11:56:38 +00:00
|
|
|
</$wikify>
|
2014-08-18 19:52:36 +00:00
|
|
|
\end
|
|
|
|
|
2016-12-17 15:29:03 +00:00
|
|
|
\define toc-unlinked-expandable-body(tag,sort:"",itemClassFilter:" ",exclude,path)
|
|
|
|
<!-- helper function -->
|
2018-09-10 11:56:38 +00:00
|
|
|
<$wikify name="toc-state" text="""
|
|
|
|
<$macrocall $name="qualify" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}} />
|
|
|
|
""">
|
|
|
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item" value="toc-item-selected">
|
2016-12-17 15:29:03 +00:00
|
|
|
<li class=<<toc-item-class>>>
|
|
|
|
<$reveal type="nomatch" state=<<toc-state>> text="open">
|
2018-02-21 14:44:10 +00:00
|
|
|
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
2016-12-17 15:29:03 +00:00
|
|
|
{{$:/core/images/right-arrow}}
|
|
|
|
<<toc-caption>>
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
2018-02-21 14:44:10 +00:00
|
|
|
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible tc-popup-keep">
|
2016-12-17 15:29:03 +00:00
|
|
|
{{$:/core/images/down-arrow}}
|
|
|
|
<<toc-caption>>
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
2018-09-10 11:56:38 +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-09-10 11:56:38 +00:00
|
|
|
</$wikify>
|
2014-09-05 08:49:10 +00:00
|
|
|
\end
|
|
|
|
|
2016-05-02 07:20:04 +00:00
|
|
|
\define toc-expandable-empty-message()
|
2018-09-10 11:56:38 +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
|
|
|
|
|
2016-12-17 15:29:03 +00:00
|
|
|
\define toc-expandable(tag,sort:"",itemClassFilter:" ",exclude,path)
|
2018-09-11 12:02:28 +00:00
|
|
|
<$vars tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> excluded="""[enlist<__exclude__>] -[<__tag__>]""" path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
2016-12-17 15:29:03 +00:00
|
|
|
<ol class="tc-toc toc-expandable">
|
2018-09-11 12:02:28 +00:00
|
|
|
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
|
2016-12-17 15:29:03 +00:00
|
|
|
<$list filter="[all[current]toc-link[no]]" emptyMessage=<<toc-expandable-empty-message>> >
|
2018-09-10 11:56:38 +00:00
|
|
|
<$macrocall $name="toc-unlinked-expandable-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="""itemClassFilter""" exclude=<<excluded>> path=<<path>> />
|
2016-12-17 15:29:03 +00:00
|
|
|
</$list>
|
|
|
|
</$list>
|
|
|
|
</ol>
|
2016-05-02 07:20:04 +00:00
|
|
|
</$vars>
|
2014-08-19 11:30:22 +00:00
|
|
|
\end
|
|
|
|
|
2016-12-17 15:29:03 +00:00
|
|
|
\define toc-linked-selective-expandable-body(tag,sort:"",itemClassFilter:" ",exclude,path)
|
2018-09-10 11:56:38 +00:00
|
|
|
<$wikify name="toc-state" text="""
|
|
|
|
<$macrocall $name="qualify" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}} />
|
|
|
|
""">
|
|
|
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item" value="toc-item-selected" >
|
2016-12-17 15:29:03 +00:00
|
|
|
<li class=<<toc-item-class>>>
|
|
|
|
<$link>
|
|
|
|
<$list filter="[all[current]tagging[]limit[1]]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>">
|
|
|
|
<$reveal type="nomatch" state=<<toc-state>> text="open">
|
2018-02-21 14:44:10 +00:00
|
|
|
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
2016-12-17 15:29:03 +00:00
|
|
|
{{$:/core/images/right-arrow}}
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
2018-02-21 14:44:10 +00:00
|
|
|
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible tc-popup-keep">
|
2016-12-17 15:29:03 +00:00
|
|
|
{{$:/core/images/down-arrow}}
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
</$list>
|
|
|
|
<<toc-caption>>
|
|
|
|
</$link>
|
|
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
2018-09-10 11:56:38 +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-09-10 11:56:38 +00:00
|
|
|
</$wikify>
|
2014-08-19 11:30:22 +00:00
|
|
|
\end
|
|
|
|
|
2016-12-17 15:29:03 +00:00
|
|
|
\define toc-unlinked-selective-expandable-body(tag,sort:"",itemClassFilter:" ",exclude,path)
|
2018-09-10 11:56:38 +00:00
|
|
|
<$wikify name="toc-state" text="""
|
|
|
|
<$macrocall $name="qualify" title={{{ [[$:/state/toc]addsuffix<__path__>addsuffix[-]addsuffix<currentTiddler>] }}} />
|
|
|
|
""">
|
|
|
|
<$set name="toc-item-class" filter=<<__itemClassFilter__>> emptyValue="toc-item" value="toc-item-selected">
|
2016-12-17 15:29:03 +00:00
|
|
|
<li class=<<toc-item-class>>>
|
|
|
|
<$list filter="[all[current]tagging[]limit[1]]" variable="ignore" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button> <$view field='caption'><$view field='title'/></$view>">
|
|
|
|
<$reveal type="nomatch" state=<<toc-state>> text="open">
|
2018-02-21 14:44:10 +00:00
|
|
|
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible tc-popup-keep">
|
2016-12-17 15:29:03 +00:00
|
|
|
{{$:/core/images/right-arrow}}
|
|
|
|
<<toc-caption>>
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
2018-02-21 14:44:10 +00:00
|
|
|
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible tc-popup-keep">
|
2016-12-17 15:29:03 +00:00
|
|
|
{{$:/core/images/down-arrow}}
|
|
|
|
<<toc-caption>>
|
|
|
|
</$button>
|
|
|
|
</$reveal>
|
|
|
|
</$list>
|
|
|
|
<$reveal type="match" state=<<toc-state>> text="open">
|
2018-09-10 11:56:38 +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-09-10 11:56:38 +00:00
|
|
|
</$wikify>
|
2014-09-05 08:49:10 +00:00
|
|
|
\end
|
|
|
|
|
2016-05-02 07:20:04 +00:00
|
|
|
\define toc-selective-expandable-empty-message()
|
2018-09-10 11:56:38 +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
|
|
|
|
|
2016-12-17 15:29:03 +00:00
|
|
|
\define toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path)
|
2018-09-11 12:02:28 +00:00
|
|
|
<$vars tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> excluded="""[enlist<__exclude__>] -[<__tag__>]""" path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
2016-12-17 15:29:03 +00:00
|
|
|
<ol class="tc-toc toc-selective-expandable">
|
2018-09-11 12:02:28 +00:00
|
|
|
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[enlist<__exclude__>]""">
|
2016-12-17 15:29:03 +00:00
|
|
|
<$list filter="[all[current]toc-link[no]]" variable="ignore" emptyMessage=<<toc-selective-expandable-empty-message>> >
|
2018-09-10 11:56:38 +00:00
|
|
|
<$macrocall $name=toc-unlinked-selective-expandable-body tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<excluded>> path=<<path>> >
|
2016-12-17 15:29:03 +00:00
|
|
|
</$list>
|
|
|
|
</$list>
|
|
|
|
</ol>
|
2016-05-02 07:20:04 +00:00
|
|
|
</$vars>
|
2014-08-18 19:52:36 +00:00
|
|
|
\end
|
2014-11-13 21:39:28 +00:00
|
|
|
|
2014-12-02 23:47:23 +00:00
|
|
|
\define toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"")
|
2018-09-10 11:56:38 +00:00
|
|
|
<$tiddler tiddler={{{ [<__selectedTiddler__>get[text]] }}}>
|
2016-12-17 15:29:03 +00:00
|
|
|
<div class="tc-tabbed-table-of-contents">
|
2018-09-10 11:56:38 +00:00
|
|
|
<$linkcatcher to=<<__selectedTiddler__>>>
|
2016-12-17 15:29:03 +00:00
|
|
|
<div class="tc-table-of-contents">
|
2018-09-10 11:56:38 +00:00
|
|
|
<$macrocall $name="toc-selective-expandable" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="[all[current]field:title<__selectedTiddler__>]"/>
|
2016-12-17 15:29:03 +00:00
|
|
|
</div>
|
|
|
|
</$linkcatcher>
|
|
|
|
<div class="tc-tabbed-table-of-contents-content">
|
2018-09-10 11:56:38 +00:00
|
|
|
<$reveal state=<<__selectedTiddler__>> type="nomatch" text="">
|
|
|
|
<$transclude mode="block" tiddler=<<__template__>>>
|
2016-12-17 15:29:03 +00:00
|
|
|
<h1><<toc-caption>></h1>
|
|
|
|
<$transclude mode="block">$missingText$</$transclude>
|
|
|
|
</$transclude>
|
|
|
|
</$reveal>
|
2018-09-10 11:56:38 +00:00
|
|
|
<$reveal state=<<__selectedTiddler__>> type="match" text="">
|
2016-12-17 15:29:03 +00:00
|
|
|
$unselectedText$
|
|
|
|
</$reveal>
|
|
|
|
</div>
|
|
|
|
</div>
|
2014-11-13 21:39:28 +00:00
|
|
|
</$tiddler>
|
2014-11-14 17:06:21 +00:00
|
|
|
\end
|
|
|
|
|
2014-12-02 23:47:23 +00:00
|
|
|
\define toc-tabbed-internal-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"")
|
2018-09-10 11:56:38 +00:00
|
|
|
<$linkcatcher to=<<__selectedTiddler__>>>
|
|
|
|
<$macrocall $name="toc-tabbed-external-nav" tag=<<__tag__>> sort=<<__sort__>> selectedTiddler=<<__selectedTiddler__>> unselectedText=<<__unselectedText__>> missingText=<<__missingText__>> template=<<__template__>>/>
|
2014-11-13 21:39:28 +00:00
|
|
|
</$linkcatcher>
|
|
|
|
\end
|
2014-11-14 17:06:21 +00:00
|
|
|
|