title: $:/core/macros/toc tags: $:/tags/Macro \whitespace trim \procedure _hasItemTemplate() [!is[blank]then[text]] \procedure _hasCaptionField() [get!is[blank]then] \procedure _hasCaption() [has[caption]then[caption]] \function tf.toc-getTooltip() [get[toc-tooltip]!is[blank]] :else[] \procedure toc-defaultItemTemplate() <$let tv-wikilinks="no" field={{{ [] :cascade[<_hasItemTemplate>append<_hasCaptionField>append<_hasCaption>append[title]] }}} > > > <$transclude $field=<>/> <> \end \procedure toc-newChildButton() \procedure _newChild(field:"parent") <$button tooltip=`New Child -> "$(field)$: $(currentTiddler)$"` aria-label="new child here" class="tc-btn-invisible" > <% if [<_mode>match[tocpMode]] %> <$action-sendmessage $message="tm-new-tiddler" $name=<> $value=<>/> {{$:/wikilabs/images/new-child-alone}} <% else %> <$action-sendmessage $message="tm-new-tiddler" $name=<> $value={{{[format:titlelist[]]}}}/> {{$:/core/images/new-here-button}} <% endif %> \end _newChild <% if [match[yes]] %> <% if [<_mode>match[tagMode]] %> <$macrocall $name="_newChild" field="tags"/> <% elseif [<_mode>match[tocpMode]] %> <$macrocall $name="_newChild" field=<>/> <% elseif [<_mode>match[tagLikeMode]] %> <$macrocall $name="_newChild" field=<>/> <% endif %> <% endif %> \end \function tf.toc-getItemTemplateTitle() [get[toc-itemTemplate]] :filter[has[text]] :else[has[text]then] \procedure _itemTemplate() <$transclude $tiddler=<> > <> \end \procedure toc-open-icon() $:/core/images/down-arrow \procedure toc-closed-icon() $:/core/images/right-arrow \procedure toc-hideField() toc-hide \procedure toc-includeField() toc-include \procedure toc-filterField() toc-filter \function tf.toc-itemClassFilter() [get[text]matchthen[toc-item-selected]else[toc-item]] \function tf.toc-includeClass() [subfiltermatchthen[tc-toc-include]] \function tf.toc-filterClass() [subfiltermatchthen[tc-toc-filter]] \function tf.toc-hideClass() [!is[blank]then[tc-toc-hide]] \function tf.toc-itemClass() [] [] [] [] +[join[ ]] \function tf.toc-getHideText() [get] \function tf.toc-hideIsYes() [format:titlelist[]] \function tf.toc-hide() [match[yes]then] :else[] \function tf.toc-include() [get] \function tf.toc-filter() [get] \procedure toc-filterDefault() [all[shadows+tiddlers]tag!has[draft.of]] \procedure toc-filterParent() [has!has[draft.of]] :filter[getmatch] \procedure toc-filterTagLike() [getenlist-input[]!has[draft.of]] \procedure toc-filterTagLike() [has!has[draft.of]] :filter[getenlist-input[]match] \function tf.toc-filterString() [!is[blank]then] :else[!is[blank]thenelse] \function tf.toc-mode() [matchthen[tagLikeMode]] :else[matchthen[tocpMode]else[tagMode]] \function tf.toc-newPath() [addsuffix[/]addsuffix] \procedure toc(tag,sort:"",itemClassFilter,exclude,captionField,tagField,parentField,itemTemplate) <$macrocall $name="toc-body" tag=<> sort=<> exclude=<>/> \end \procedure toc-body(tag,sort:"",itemClassFilter,exclude,path) <$set name=currentTiddler filter="[!is[blank]thenelse]">
    <$list filter=` [subfilter] :else[subfilter$(sort)$] [subfilter] -[] -[subfilter]`> <%if [] -[subfilter] %> <$let _path=<> _mode=<> > <$set name="_excluded" filter="[subfilter] [] [subfilter]">
  1. >> <% if [all[current]toc-link[no]] %> <<_itemTemplate>> <% else %> <$link to={{{ [get[target]else] }}}> <<_itemTemplate>> <% endif %> <$macrocall $name="toc-body" tag=<> exclude=<<_excluded>> path=<<_path>> />
  2. <% endif %>
\end \procedure toc-tagLikeChildFilter() [getenlist-input[]] -[toc-hide[yes]] \procedure toc-tagLikeChildFilter() [has] :filter[getenlist-input[]match<..currentTiddler>] -[toc-hide[yes]] \procedure toc-parentChildFilter() [has] :filter[getmatch<..currentTiddler>] -[toc-hide[yes]] \procedure toc-tagChildFilter() [tag] -[toc-hide[yes]] \function tf.toc-hasChildren() [!is[blank]then] :else[!is[blank]then] :else[] \end \function tf.toc-stateTitle() [[$:/state/toc]] [] "/" [] +[join[]] \procedure toc-openBranch(path,currentTiddler,manual:"no") \procedure recursiveOpen(exclude, path) <$let path={{{ [] "/" [] +[join[]] }}}> <$list filter="[subfilter] [subfilter] -[] -[subfilter]" > <% if [subfilter] [subfilter] -[] -[subfilter] %> <$set name="_excluded" filter="[subfilter] []"> <$qualify name="toc-state" title=<> > <$action-setfield $tiddler=<> text="open"/> <$macrocall $name="recursiveOpen" exclude=<<_excluded>> path=<> /> <% endif %> \end recursiveOpen <% if [match[yes]] %> <$qualify name="toc-state" title=<> > <$action-setfield $tiddler=<> text="open"/> <$macrocall $name="recursiveOpen" exclude=<> path=<> /> <% elseif [match[ctrl]] %> <$macrocall $name="recursiveOpen" exclude=<> path=<> /> <% endif %> \end \procedure toc-closeBranch(path,currentTiddler,manual:"no") <% if [match[ctrl]] :else[match[yes]] %> <$let prefix={{{ [] }}} > <$action-deletetiddler $filter="[prefix]"/> <% endif %> \end \procedure toc-item(isUnlinked:"") <% if [get[text]else[close]match[close]] %> <$button actions=<> setTitle=<> setTo="open" class="tc-btn-invisible tc-tiny-gap-right"> <$transclude tiddler=<> /> <% if [match[yes]] %> <<_itemTemplate>> <% endif %> <% elseif [get[text]match[open]] %> <$button actions=<> setTitle=<> setTo="close" class="tc-btn-invisible tc-tiny-gap-right"> <$transclude tiddler=<> /> <% if [match[yes]] %> <<_itemTemplate>> <% endif %> <% endif %> \end \procedure toc-linked-expandable-body(tag,sort:"",itemClassFilter,exclude,path,captionField,tagField,parentField,itemTemplate) <$qualify name="toc-state" title=<> >
  • >> <$link to={{{ [get[target]else] }}}> <> <<_itemTemplate>> <% if [get[text]match[open]] %> <$macrocall $name="toc-expandable" tag=<> sort=<> exclude=<> path=<> captionField=<> tagField=<> parentField=<> itemTemplate=<> /> <% endif %>
  • \end \procedure toc-unlinked-expandable-body(tag,sort:"",itemClassFilter,exclude,path,captionField,tagField,parentField,itemTemplate) <$qualify name="toc-state" title=<>>
  • >> <> <% if [get[text]match[open]] %> <$macrocall $name="toc-expandable" tag=<> sort=<> exclude=<> path=<> captionField=<> tagField=<> parentField=<> itemTemplate=<> /> <% endif %>
  • \end \procedure toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path,captionField,tagField,parentField,itemTemplate) <$set name=currentTiddler filter="[!is[blank]thenelse]">
      <$list filter=` [subfilter] :else[subfilter$(sort)$] [subfilter] -[] -[subfilter]`> <%if [] -[subfilter] %> <$let _path=<> _mode=<> > <$set name="_excluded" filter="[subfilter] [] [subfilter]"> <% if [all[current]toc-link[no]] %> <$macrocall $name="toc-unlinked-expandable-body" tag=<> sort=<> exclude=<<_excluded>> path=<<_path>> captionField=<> tagField=<> parentField=<> itemTemplate=<> /> <% else %> <$macrocall $name="toc-linked-expandable-body" tag=<> sort=<> exclude=<<_excluded>> path=<<_path>> captionField=<> tagField=<> parentField=<> itemTemplate=<> /> <% endif %> <% endif %>
    \end \function tf.toc-curTidInclude() [get] [get] \procedure toc-linked-selective-expandable-body(tag,sort:"",itemClassFilter,exclude,path,captionField,tagField,parentField,itemTemplate) <$qualify name="toc-state" title=<>>
  • >> <$link to={{{ [get[target]else] }}}> <% if [subfilter] [subfilter] -[] -[subfilter] +[limit[1]] %> <> <% else %> <$button class='tc-btn-invisible tc-tiny-gap-right' tabindex="-1"> {{$:/core/images/blank}} <% endif %> <<_itemTemplate>> <% if [get[text]match[open]] %> <$macrocall $name="toc-selective-expandable" tag=<> sort=<> exclude=<> path=<> captionField=<> tagField=<> parentField=<> itemTemplate=<> /> <% endif %>
  • \end \procedure toc-unlinked-selective-expandable-body(tag,sort:"",itemClassFilter,exclude,path,captionField,tagField,parentField,itemTemplate) <$qualify name="toc-state" title=<> >
  • >> <% if [subfilter] [subfilter] -[] -[subfilter] +[limit[1]] %> <> <% else %> <$button class="tc-btn-invisible tc-tiny-gap"> {{$:/core/images/blank}} <<_itemTemplate>> <% endif %> <% if [get[text]match[open]] %> <$macrocall $name="toc-selective-expandable" tag=<> sort=<> exclude=<> path=< captionField=<> tagField=<> parentField=<> itemTemplate=<> /> <% endif %>
  • \end \procedure toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path,captionField,tagField,parentField,itemTemplate) <$set name=currentTiddler filter="[!is[blank]thenelse]">
      <$list filter=` [subfilter] :else[subfilter$(sort)$] [subfilter] -[] -[subfilter]`> <%if [] -[subfilter] %> <$let _path=<> _mode=<> > <$set name="_excluded" filter="[subfilter] [] [subfilter]"> <% if [all[current]toc-link[no]] %> <$macrocall $name="toc-unlinked-selective-expandable-body" tag=<> sort=<> exclude=<<_excluded>> path=<<_path>> captionField=<> tagField=<> parentField=<> itemTemplate=<> /> <% else %> <$macrocall $name="toc-linked-selective-expandable-body" tag=<> sort=<> exclude=<<_excluded>> path=<<_path>> captionField=<> tagField=<> parentField=<> itemTemplate=<> /> <% endif %> <% endif %>
    \end \procedure toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude,captionField,tagField,parentField,itemTemplate) <$tiddler tiddler={{{ [get[text]] }}}>
    <$linkcatcher to=<>>
    <$macrocall $name="toc-selective-expandable" tag=<> sort=<> exclude=<> captionField=<> tagField=<> parentField=<> itemTemplate=<> />
    <$reveal stateTitle=<> type="nomatch" text=""> <$transclude mode="block" tiddler=<