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 -->
|
<!-- Use this item template as a default -->
|
||||||
\procedure toc-defaultItemTemplate()
|
\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]] }}}
|
field={{{ [<currentTiddler>] :cascade[<_hasItemTemplate>append<_hasCaptionField>append<_hasCaption>append[title]] }}}
|
||||||
>
|
>
|
||||||
<span class=""
|
<span class=""
|
||||||
data-fieldClass=`field-$(field)$`
|
data-fieldClass=`field-$(field)$`
|
||||||
title=<<tf.toc-getTooltip>>
|
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>>
|
<<toc-newChildButton>>
|
||||||
<!-- Do not remove next line it's needed for debugging -->
|
<!-- Do not remove next line it's needed for debugging -->
|
||||||
<!-- <sup class="tc-small-gap-left"><<_mode>></sup> -->
|
<!-- <sup class="tc-small-gap-left"><<_mode>></sup> -->
|
||||||
</$let>
|
</$let>
|
||||||
|
<%endif%>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\procedure toc-newChildButton()
|
\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()
|
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)
|
\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>>/>
|
<$macrocall $name="toc-body" tag=<<tag>> sort=<<sort>> exclude=<<exclude>>/>
|
||||||
|
</$let>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
<!-- Simple toc helper body -->
|
<!-- 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>]
|
:else[<toc-tagChildFilter>]
|
||||||
\end
|
\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 -->
|
<!-- toc-openBranch internally uses a recursiveOpen() procedure -->
|
||||||
\procedure toc-openBranch(path,currentTiddler,manual:"no")
|
\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")
|
\procedure toc-closeBranch(path,currentTiddler,manual:"no")
|
||||||
<% if [<modifier>match[ctrl]] :else[<manual>match[yes]] %>
|
<% 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<prefix>]"/>
|
||||||
|
<$action-deletetiddler $filter="[prefix<tf.toc-stateTitle>]"/>
|
||||||
</$let>
|
</$let>
|
||||||
<% endif %>
|
<% endif %>
|
||||||
\end
|
\end
|
||||||
@ -236,7 +245,6 @@ v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter see: tf.toc-i
|
|||||||
-->
|
-->
|
||||||
\procedure toc-item(isUnlinked:"")
|
\procedure toc-item(isUnlinked:"")
|
||||||
<% if [<toc-state>get[text]else[close]match[close]] %>
|
<% 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">
|
<$button actions=<<toc-openBranch>> setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible tc-tiny-gap-right">
|
||||||
<$transclude tiddler=<<toc-closed-icon>> />
|
<$transclude tiddler=<<toc-closed-icon>> />
|
||||||
<% if [<isUnlinked>match[yes]] %>
|
<% if [<isUnlinked>match[yes]] %>
|
||||||
@ -244,7 +252,6 @@ v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter see: tf.toc-i
|
|||||||
<% endif %>
|
<% endif %>
|
||||||
</$button>
|
</$button>
|
||||||
<% elseif [<toc-state>get[text]match[open]] %>
|
<% 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">
|
<$button actions=<<toc-closeBranch>> setTitle=<<toc-state>> setTo="close" class="tc-btn-invisible tc-tiny-gap-right">
|
||||||
<$transclude tiddler=<<toc-open-icon>> />
|
<$transclude tiddler=<<toc-open-icon>> />
|
||||||
<% if [<isUnlinked>match[yes]] %>
|
<% 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
|
Shows an expandable toc. Item always have an open/close chevron
|
||||||
=============================================================== -->
|
=============================================================== -->
|
||||||
\procedure toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path,captionField,tagField,parentField,itemTemplate)
|
\procedure toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path,captionField,tagField,parentField,itemTemplate)
|
||||||
<$set name=currentTiddler filter="[<parentField>!is[blank]then<tag>else<currentTiddler>]">
|
<$let tag={{{ [<tag>is[blank]then<currentTiddler>else<tag>] }}} >
|
||||||
<ol class="tc-toc toc-expandable">
|
<$set name=currentTiddler filter="[<parentField>!is[blank]then<tag>else<currentTiddler>]">
|
||||||
|
<ol class="tc-toc toc-expandable">
|
||||||
<!-- Text substitution is needed for backwards compatibility -->
|
<!-- Text substitution is needed for backwards compatibility -->
|
||||||
<$list filter=` [subfilter<tf.toc-filter>]
|
<$list filter=` [subfilter<tf.toc-filter>]
|
||||||
:else[subfilter<tf.toc-filterString>$(sort)$]
|
:else[subfilter<tf.toc-filterString>$(sort)$]
|
||||||
@ -320,8 +328,9 @@ Shows an expandable toc. Item always have an open/close chevron
|
|||||||
</$let>
|
</$let>
|
||||||
<% endif %>
|
<% endif %>
|
||||||
</$list>
|
</$list>
|
||||||
</ol>
|
</ol>
|
||||||
</$set>
|
</$set>
|
||||||
|
</$let>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\function tf.toc-curTidInclude() [<currentTiddler>get<toc-includeField>] [<currentTiddler>get<toc-filterField>]
|
\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
|
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)
|
\procedure toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path,captionField,tagField,parentField,itemTemplate)
|
||||||
<$set name=currentTiddler filter="[<parentField>!is[blank]then<tag>else<currentTiddler>]">
|
<$let tag={{{ [<tag>is[blank]then<currentTiddler>else<tag>] }}} >
|
||||||
<ol class="tc-toc toc-selective-expandable">
|
<$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 -->
|
<!-- text substitution is needed for backwards compatibility -->
|
||||||
<$list filter=` [subfilter<tf.toc-filter>]
|
<$list filter=` [subfilter<tf.toc-filter>]
|
||||||
:else[subfilter<tf.toc-filterString>$(sort)$]
|
:else[subfilter<tf.toc-filterString>$(sort)$]
|
||||||
@ -423,8 +433,9 @@ If an item has no children, there is no open/close chevron
|
|||||||
</$let>
|
</$let>
|
||||||
<% endif %>
|
<% endif %>
|
||||||
</$list>
|
</$list>
|
||||||
</ol>
|
</ol>
|
||||||
</$set>
|
</$set>
|
||||||
|
</$let>
|
||||||
\end
|
\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
|
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)
|
\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">
|
<div class="tc-tabbed-table-of-contents">
|
||||||
<$linkcatcher to=<<selectedTiddler>>>
|
<$linkcatcher to=<<selectedTiddler>>>
|
||||||
<div class="tc-table-of-contents">
|
<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>
|
</$reveal>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</$tiddler>
|
</$tiddler>
|
||||||
|
</$let>
|
||||||
\end
|
\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
|
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)
|
\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"
|
<$macrocall $name="toc-tabbed-external-nav"
|
||||||
tag=<<tag>>
|
tag=<<tag>>
|
||||||
sort=<<sort>>
|
sort=<<sort>>
|
||||||
@ -478,5 +492,6 @@ it will open the tiddler in the view area of the same tiddler
|
|||||||
parentField=<<parentField>>
|
parentField=<<parentField>>
|
||||||
itemTemplate=<<itemTemplate>>
|
itemTemplate=<<itemTemplate>>
|
||||||
/>
|
/>
|
||||||
</$linkcatcher>
|
</$linkcatcher>
|
||||||
|
</$let>
|
||||||
\end
|
\end
|
||||||
|
Loading…
Reference in New Issue
Block a user