mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-06-25 14:43:01 +00:00
Toc uses currentTiddler as "tag" default parameter if it is missing (#8291)
* toc's use currentTiddler, if tag prameter is undefined * add currentTiddler info to toc documentation
This commit is contained in:
parent
c060216a8e
commit
b68de0d69f
@ -37,7 +37,10 @@ tags: $:/tags/Macro
|
||||
\end
|
||||
|
||||
\define toc(tag,sort:"",itemClassFilter:"", exclude)
|
||||
\whitespace trim
|
||||
<$let __tag__={{{ [<__tag__>is[blank]then<currentTiddler>else<__tag__>] }}} >
|
||||
<$macrocall $name="toc-body" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> exclude=<<__exclude__>>/>
|
||||
</$let>
|
||||
\end
|
||||
|
||||
\define toc-linked-expandable-body(tag,sort:"",itemClassFilter,exclude,path)
|
||||
@ -99,7 +102,7 @@ tags: $:/tags/Macro
|
||||
|
||||
\define toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path)
|
||||
\whitespace trim
|
||||
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||
<$let __tag__={{{ [<__tag__>is[blank]then<currentTiddler>else<__tag__>] }}} tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
||||
<ol class="tc-toc toc-expandable">
|
||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
||||
@ -173,7 +176,7 @@ tags: $:/tags/Macro
|
||||
|
||||
\define toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path)
|
||||
\whitespace trim
|
||||
<$let tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||
<$let __tag__={{{ [<__tag__>is[blank]then<currentTiddler>else<__tag__>] }}} tag=<<__tag__>> sort=<<__sort__>> itemClassFilter=<<__itemClassFilter__>> path={{{ [<__path__>addsuffix[/]addsuffix<__tag__>] }}}>
|
||||
<$set name="excluded" filter="[subfilter<__exclude__>] [<__tag__>]">
|
||||
<ol class="tc-toc toc-selective-expandable">
|
||||
<$list filter="""[all[shadows+tiddlers]tag<__tag__>!has[draft.of]$sort$] -[<__tag__>] -[subfilter<__exclude__>]""">
|
||||
@ -188,6 +191,7 @@ tags: $:/tags/Macro
|
||||
|
||||
\define toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude)
|
||||
\whitespace trim
|
||||
<$let __tag__={{{ [<__tag__>is[blank]then<currentTiddler>else<__tag__>] }}}>
|
||||
<$tiddler tiddler={{{ [<__selectedTiddler__>get[text]] }}}>
|
||||
<div class="tc-tabbed-table-of-contents">
|
||||
<$linkcatcher to=<<__selectedTiddler__>>>
|
||||
@ -208,11 +212,14 @@ tags: $:/tags/Macro
|
||||
</div>
|
||||
</div>
|
||||
</$tiddler>
|
||||
</$let>
|
||||
\end
|
||||
|
||||
\define toc-tabbed-internal-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude)
|
||||
\whitespace trim
|
||||
<$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>
|
||||
\end
|
||||
|
@ -1,5 +1,5 @@
|
||||
created: 20140919155729620
|
||||
modified: 20230427125500432
|
||||
modified: 20240624102502089
|
||||
tags: Macros [[Core Macros]]
|
||||
title: Table-of-Contents Macros
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -8,10 +8,13 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
; <<.var toc>>
|
||||
: A simple tree
|
||||
|
||||
; <<.var toc-expandable>>
|
||||
: A tree in which all the branches can be expanded and collapsed
|
||||
|
||||
; <<.var toc-selective-expandable>>
|
||||
: A tree in which the non-empty branches can be expanded and collapsed
|
||||
|
||||
; <<.var toc-tabbed-internal-nav>> and <<.var toc-tabbed-external-nav>>
|
||||
: A two-panel browser:
|
||||
:* on the left, a selectively expandable tree that behaves like a set of vertical tabs
|
||||
@ -21,6 +24,7 @@ The difference between the last two has to do with what happens when the user cl
|
||||
|
||||
; <<.var toc-tabbed-internal-nav>>
|
||||
: The target tiddler appears in the right-hand panel, replacing the tiddler that contained the link
|
||||
|
||||
; <<.var toc-tabbed-external-nav>>
|
||||
: The target tiddler appears in the normal way (which depends on the user's configured storyview)
|
||||
|
||||
@ -44,6 +48,8 @@ To make a table of contents appear in the sidebar, see [[How to add a new tab to
|
||||
|
||||
; tag
|
||||
: The root tag that identifies the top level of the tree
|
||||
: <<.from-version "5.3.5">> If the <<.param tag>> parameter is "missing" or "an empty" string, the <<.var curretTiddler>> variable is used
|
||||
|
||||
; sort
|
||||
: An optional extra [[filter step|Filter Step]], e.g. `sort[title]`
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user