mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 19:47:20 +00:00
use currentTiddler as tag default parameter if it is missing
This commit is contained in:
parent
476902e59b
commit
035b4ceed3
@ -26,9 +26,12 @@ The very first toc macro is _not_ reused. So it can be used as a simple referenc
|
||||
|
||||
<!-- Use this item template as a default -->
|
||||
\procedure toc-defaultItemTemplate()
|
||||
<$let tv-wikilinks="no"
|
||||
<%if [<_mode>match[tagMode][toc-caption]is[variable]] %>
|
||||
<$transclude $variable="toc-caption"/>
|
||||
<%else%>
|
||||
<$let tv-wikilinks="no"
|
||||
field={{{ [<currentTiddler>] :cascade[<_hasItemTemplate>append<_hasCaptionField>append<_hasCaption>append[title]] }}}
|
||||
>
|
||||
>
|
||||
<span class=""
|
||||
data-fieldClass=`field-$(field)$`
|
||||
title=<<tf.toc-getTooltip>>
|
||||
@ -38,7 +41,8 @@ The very first toc macro is _not_ reused. So it can be used as a simple referenc
|
||||
<<toc-newChildButton>>
|
||||
<!-- Do not remove next line it's needed for debugging -->
|
||||
<!-- <sup class="tc-small-gap-left"><<_mode>></sup> -->
|
||||
</$let>
|
||||
</$let>
|
||||
<%endif%>
|
||||
\end
|
||||
|
||||
\procedure toc-newChildButton()
|
||||
@ -129,7 +133,9 @@ This macro is _not_ used by other toc-macros
|
||||
v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter see: tf.toc-itemClass()
|
||||
========================================================================================== -->
|
||||
\procedure toc(tag,sort:"",itemClassFilter,exclude,captionField,tagField,parentField,itemTemplate)
|
||||
<$let tag={{{ [<tag>is[blank]then<currentTiddler>else<tag>] }}} >
|
||||
<$macrocall $name="toc-body" tag=<<tag>> sort=<<sort>> exclude=<<exclude>>/>
|
||||
</$let>
|
||||
\end
|
||||
|
||||
<!-- Simple toc helper body -->
|
||||
@ -184,7 +190,9 @@ v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter see: tf.toc-i
|
||||
:else[<toc-tagChildFilter>]
|
||||
\end
|
||||
|
||||
\function tf.toc-stateTitle() [[$:/state/toc]] [<path>] "/" [<currentTiddler>] +[join[]]
|
||||
<!-- Last path separator needs to be "-" for backwards compatibility :/ -->
|
||||
\function tf.toc-stateTitle() [[$:/state/toc]] [<path>] "-" [<currentTiddler>] +[join[]]
|
||||
\function tf.toc-closePrefix() [[$:/state/toc]] [<path>] "/" [<currentTiddler>] +[join[]]
|
||||
|
||||
<!-- toc-openBranch internally uses a recursiveOpen() procedure -->
|
||||
\procedure toc-openBranch(path,currentTiddler,manual:"no")
|
||||
@ -222,8 +230,9 @@ v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter see: tf.toc-i
|
||||
|
||||
\procedure toc-closeBranch(path,currentTiddler,manual:"no")
|
||||
<% if [<modifier>match[ctrl]] :else[<manual>match[yes]] %>
|
||||
<$let prefix={{{ [<tf.toc-stateTitle>] }}} >
|
||||
<$let prefix={{{ [<tf.toc-closePrefix>] }}} >
|
||||
<$action-deletetiddler $filter="[prefix<prefix>]"/>
|
||||
<$action-deletetiddler $filter="[prefix<tf.toc-stateTitle>]"/>
|
||||
</$let>
|
||||
<% endif %>
|
||||
\end
|
||||
@ -236,7 +245,6 @@ v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter see: tf.toc-i
|
||||
-->
|
||||
\procedure toc-item(isUnlinked:"")
|
||||
<% if [<toc-state>get[text]else[close]match[close]] %>
|
||||
<!-- <$button actions=<<toc-openBranch>> setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible" tooltip=<<toc-state>>> -->
|
||||
<$button actions=<<toc-openBranch>> setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-tiny-gap-right">
|
||||
<$transclude tiddler=<<toc-closed-icon>> />
|
||||
<% if [<isUnlinked>match[yes]] %>
|
||||
@ -244,7 +252,6 @@ v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter see: tf.toc-i
|
||||
<% endif %>
|
||||
</$button>
|
||||
<% elseif [<toc-state>get[text]match[open]] %>
|
||||
<!-- <$button actions=<<toc-closeBranch>> setTitle=<<toc-state>> setTo="close" class="tc-btn-invisible" tooltip=<<toc-state>>> -->
|
||||
<$button actions=<<toc-closeBranch>> setTitle=<<toc-state>> setTo="close" class="tc-btn-invisible tc-tiny-gap-right">
|
||||
<$transclude tiddler=<<toc-open-icon>> />
|
||||
<% if [<isUnlinked>match[yes]] %>
|
||||
@ -294,8 +301,9 @@ v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter see: tf.toc-i
|
||||
Shows an expandable toc. Item always have an open/close chevron
|
||||
=============================================================== -->
|
||||
\procedure toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path,captionField,tagField,parentField,itemTemplate)
|
||||
<$set name=currentTiddler filter="[<parentField>!is[blank]then<tag>else<currentTiddler>]">
|
||||
<ol class="tc-toc toc-expandable">
|
||||
<$let tag={{{ [<tag>is[blank]then<currentTiddler>else<tag>] }}} >
|
||||
<$set name=currentTiddler filter="[<parentField>!is[blank]then<tag>else<currentTiddler>]">
|
||||
<ol class="tc-toc toc-expandable">
|
||||
<!-- Text substitution is needed for backwards compatibility -->
|
||||
<$list filter=` [subfilter<tf.toc-filter>]
|
||||
:else[subfilter<tf.toc-filterString>$(sort)$]
|
||||
@ -320,8 +328,9 @@ Shows an expandable toc. Item always have an open/close chevron
|
||||
</$let>
|
||||
<% endif %>
|
||||
</$list>
|
||||
</ol>
|
||||
</$set>
|
||||
</ol>
|
||||
</$set>
|
||||
</$let>
|
||||
\end
|
||||
|
||||
\function tf.toc-curTidInclude() [<currentTiddler>get<toc-includeField>] [<currentTiddler>get<toc-filterField>]
|
||||
@ -397,8 +406,9 @@ Shows a selctive expandable toc.
|
||||
If an item has no children, there is no open/close chevron
|
||||
========================================================== -->
|
||||
\procedure toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path,captionField,tagField,parentField,itemTemplate)
|
||||
<$set name=currentTiddler filter="[<parentField>!is[blank]then<tag>else<currentTiddler>]">
|
||||
<ol class="tc-toc toc-selective-expandable">
|
||||
<$let tag={{{ [<tag>is[blank]then<currentTiddler>else<tag>] }}} >
|
||||
<$set name=currentTiddler filter="[<parentField>!is[blank]then<tag>else<currentTiddler>]">
|
||||
<ol class="tc-toc toc-selective-expandable">
|
||||
<!-- text substitution is needed for backwards compatibility -->
|
||||
<$list filter=` [subfilter<tf.toc-filter>]
|
||||
:else[subfilter<tf.toc-filterString>$(sort)$]
|
||||
@ -423,8 +433,9 @@ If an item has no children, there is no open/close chevron
|
||||
</$let>
|
||||
<% endif %>
|
||||
</$list>
|
||||
</ol>
|
||||
</$set>
|
||||
</ol>
|
||||
</$set>
|
||||
</$let>
|
||||
\end
|
||||
|
||||
<!-- ====================================================================
|
||||
@ -432,7 +443,8 @@ Shows a tabbed toc.
|
||||
If a toc-item link is clicked it will open the tiddler in the story river
|
||||
========================================================================= -->
|
||||
\procedure toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude,captionField,tagField,parentField,itemTemplate)
|
||||
<$tiddler tiddler={{{ [<selectedTiddler>get[text]] }}}>
|
||||
<$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">
|
||||
@ -456,7 +468,8 @@ If a toc-item link is clicked it will open the tiddler in the story river
|
||||
</$reveal>
|
||||
</div>
|
||||
</div>
|
||||
</$tiddler>
|
||||
</$tiddler>
|
||||
</$let>
|
||||
\end
|
||||
|
||||
<!-- ========================================================
|
||||
@ -464,7 +477,8 @@ Shows a tabbed toc. If a toc-item link is clicked
|
||||
it will open the tiddler in the view area of the same tiddler
|
||||
============================================================= -->
|
||||
\procedure toc-tabbed-internal-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude,captionField,tagField,parentField,itemTemplate)
|
||||
<$linkcatcher to=<<selectedTiddler>>>
|
||||
<$let tag={{{ [<tag>is[blank]then<currentTiddler>else<tag>] }}} >
|
||||
<$linkcatcher to=<<selectedTiddler>>>
|
||||
<$macrocall $name="toc-tabbed-external-nav"
|
||||
tag=<<tag>>
|
||||
sort=<<sort>>
|
||||
@ -478,5 +492,6 @@ it will open the tiddler in the view area of the same tiddler
|
||||
parentField=<<parentField>>
|
||||
itemTemplate=<<itemTemplate>>
|
||||
/>
|
||||
</$linkcatcher>
|
||||
</$linkcatcher>
|
||||
</$let>
|
||||
\end
|
||||
|
Loading…
Reference in New Issue
Block a user