mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
use currentTiddler as tag default parameter if it is missing
This commit is contained in:
parent
476902e59b
commit
035b4ceed3
@ -26,19 +26,23 @@ 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]] %>
|
||||||
field={{{ [<currentTiddler>] :cascade[<_hasItemTemplate>append<_hasCaptionField>append<_hasCaption>append[title]] }}}
|
<$transclude $variable="toc-caption"/>
|
||||||
>
|
<%else%>
|
||||||
<span class=""
|
<$let tv-wikilinks="no"
|
||||||
data-fieldClass=`field-$(field)$`
|
field={{{ [<currentTiddler>] :cascade[<_hasItemTemplate>append<_hasCaptionField>append<_hasCaption>append[title]] }}}
|
||||||
title=<<tf.toc-getTooltip>>
|
|
||||||
>
|
>
|
||||||
<$transclude $field=<<field>>/>
|
<span class=""
|
||||||
</span>
|
data-fieldClass=`field-$(field)$`
|
||||||
<<toc-newChildButton>>
|
title=<<tf.toc-getTooltip>>
|
||||||
<!-- Do not remove next line it's needed for debugging -->
|
>
|
||||||
<!-- <sup class="tc-small-gap-left"><<_mode>></sup> -->
|
<$transclude $field=<<field>>/>
|
||||||
</$let>
|
</span>
|
||||||
|
<<toc-newChildButton>>
|
||||||
|
<!-- Do not remove next line it's needed for debugging -->
|
||||||
|
<!-- <sup class="tc-small-gap-left"><<_mode>></sup> -->
|
||||||
|
</$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,34 +301,36 @@ 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>]">
|
||||||
<!-- Text substitution is needed for backwards compatibility -->
|
<ol class="tc-toc toc-expandable">
|
||||||
<$list filter=` [subfilter<tf.toc-filter>]
|
<!-- Text substitution is needed for backwards compatibility -->
|
||||||
:else[subfilter<tf.toc-filterString>$(sort)$]
|
<$list filter=` [subfilter<tf.toc-filter>]
|
||||||
[subfilter<tf.toc-include>] -[<tag>] -[subfilter<exclude>]`>
|
:else[subfilter<tf.toc-filterString>$(sort)$]
|
||||||
<%if [<currentTiddler>] -[subfilter<tf.toc-hide>] %>
|
[subfilter<tf.toc-include>] -[<tag>] -[subfilter<exclude>]`>
|
||||||
<$let _path=<<tf.toc-newPath>> _mode=<<tf.toc-mode>> >
|
<%if [<currentTiddler>] -[subfilter<tf.toc-hide>] %>
|
||||||
<$set name="_excluded" filter="[subfilter<exclude>] [<tag>] [subfilter<tf.toc-hide>]">
|
<$let _path=<<tf.toc-newPath>> _mode=<<tf.toc-mode>> >
|
||||||
<% if [all[current]toc-link[no]] %>
|
<$set name="_excluded" filter="[subfilter<exclude>] [<tag>] [subfilter<tf.toc-hide>]">
|
||||||
<$macrocall $name="toc-unlinked-expandable-body"
|
<% if [all[current]toc-link[no]] %>
|
||||||
tag=<<tag>> sort=<<sort>> exclude=<<_excluded>> path=<<_path>>
|
<$macrocall $name="toc-unlinked-expandable-body"
|
||||||
captionField=<<captionField>> tagField=<<tagField>> parentField=<<parentField>>
|
tag=<<tag>> sort=<<sort>> exclude=<<_excluded>> path=<<_path>>
|
||||||
itemTemplate=<<itemTemplate>>
|
captionField=<<captionField>> tagField=<<tagField>> parentField=<<parentField>>
|
||||||
/>
|
itemTemplate=<<itemTemplate>>
|
||||||
<% else %>
|
/>
|
||||||
<$macrocall $name="toc-linked-expandable-body"
|
<% else %>
|
||||||
tag=<<tag>> sort=<<sort>> exclude=<<_excluded>> path=<<_path>>
|
<$macrocall $name="toc-linked-expandable-body"
|
||||||
captionField=<<captionField>> tagField=<<tagField>> parentField=<<parentField>>
|
tag=<<tag>> sort=<<sort>> exclude=<<_excluded>> path=<<_path>>
|
||||||
itemTemplate=<<itemTemplate>>
|
captionField=<<captionField>> tagField=<<tagField>> parentField=<<parentField>>
|
||||||
/>
|
itemTemplate=<<itemTemplate>>
|
||||||
<% endif %>
|
/>
|
||||||
</$set>
|
<% endif %>
|
||||||
</$let>
|
</$set>
|
||||||
<% endif %>
|
</$let>
|
||||||
</$list>
|
<% endif %>
|
||||||
</ol>
|
</$list>
|
||||||
</$set>
|
</ol>
|
||||||
|
</$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,34 +406,36 @@ 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>]">
|
||||||
<!-- text substitution is needed for backwards compatibility -->
|
<ol class="tc-toc toc-selective-expandable">
|
||||||
<$list filter=` [subfilter<tf.toc-filter>]
|
<!-- text substitution is needed for backwards compatibility -->
|
||||||
:else[subfilter<tf.toc-filterString>$(sort)$]
|
<$list filter=` [subfilter<tf.toc-filter>]
|
||||||
[subfilter<tf.toc-include>] -[<tag>] -[subfilter<exclude>]`>
|
:else[subfilter<tf.toc-filterString>$(sort)$]
|
||||||
<%if [<currentTiddler>] -[subfilter<tf.toc-hide>] %>
|
[subfilter<tf.toc-include>] -[<tag>] -[subfilter<exclude>]`>
|
||||||
<$let _path=<<tf.toc-newPath>> _mode=<<tf.toc-mode>> >
|
<%if [<currentTiddler>] -[subfilter<tf.toc-hide>] %>
|
||||||
<$set name="_excluded" filter="[subfilter<exclude>] [<tag>] [subfilter<tf.toc-hide>]">
|
<$let _path=<<tf.toc-newPath>> _mode=<<tf.toc-mode>> >
|
||||||
<% if [all[current]toc-link[no]] %>
|
<$set name="_excluded" filter="[subfilter<exclude>] [<tag>] [subfilter<tf.toc-hide>]">
|
||||||
<$macrocall $name="toc-unlinked-selective-expandable-body"
|
<% if [all[current]toc-link[no]] %>
|
||||||
tag=<<tag>> sort=<<sort>> exclude=<<_excluded>> path=<<_path>>
|
<$macrocall $name="toc-unlinked-selective-expandable-body"
|
||||||
captionField=<<captionField>> tagField=<<tagField>> parentField=<<parentField>>
|
tag=<<tag>> sort=<<sort>> exclude=<<_excluded>> path=<<_path>>
|
||||||
itemTemplate=<<itemTemplate>>
|
captionField=<<captionField>> tagField=<<tagField>> parentField=<<parentField>>
|
||||||
/>
|
itemTemplate=<<itemTemplate>>
|
||||||
<% else %>
|
/>
|
||||||
<$macrocall $name="toc-linked-selective-expandable-body"
|
<% else %>
|
||||||
tag=<<tag>> sort=<<sort>> exclude=<<_excluded>> path=<<_path>>
|
<$macrocall $name="toc-linked-selective-expandable-body"
|
||||||
captionField=<<captionField>> tagField=<<tagField>> parentField=<<parentField>>
|
tag=<<tag>> sort=<<sort>> exclude=<<_excluded>> path=<<_path>>
|
||||||
itemTemplate=<<itemTemplate>>
|
captionField=<<captionField>> tagField=<<tagField>> parentField=<<parentField>>
|
||||||
/>
|
itemTemplate=<<itemTemplate>>
|
||||||
<% endif %>
|
/>
|
||||||
</$set>
|
<% endif %>
|
||||||
</$let>
|
</$set>
|
||||||
<% endif %>
|
</$let>
|
||||||
</$list>
|
<% endif %>
|
||||||
</ol>
|
</$list>
|
||||||
</$set>
|
</ol>
|
||||||
|
</$set>
|
||||||
|
</$let>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
<!-- ====================================================================
|
<!-- ====================================================================
|
||||||
@ -432,31 +443,33 @@ 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>] }}} >
|
||||||
<div class="tc-tabbed-table-of-contents">
|
<$tiddler tiddler={{{ [<selectedTiddler>get[text]] }}}>
|
||||||
<$linkcatcher to=<<selectedTiddler>>>
|
<div class="tc-tabbed-table-of-contents">
|
||||||
<div class="tc-table-of-contents">
|
<$linkcatcher to=<<selectedTiddler>>>
|
||||||
<!-- v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter -->
|
<div class="tc-table-of-contents">
|
||||||
<$macrocall $name="toc-selective-expandable"
|
<!-- v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter -->
|
||||||
tag=<<tag>> sort=<<sort>> exclude=<<exclude>>
|
<$macrocall $name="toc-selective-expandable"
|
||||||
captionField=<<captionField>> tagField=<<tagField>> parentField=<<parentField>>
|
tag=<<tag>> sort=<<sort>> exclude=<<exclude>>
|
||||||
itemTemplate=<<itemTemplate>>
|
captionField=<<captionField>> tagField=<<tagField>> parentField=<<parentField>>
|
||||||
/>
|
itemTemplate=<<itemTemplate>>
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</$linkcatcher>
|
||||||
|
<div class="tc-tabbed-table-of-contents-content">
|
||||||
|
<$reveal stateTitle=<<selectedTiddler>> type="nomatch" text="">
|
||||||
|
<$transclude mode="block" tiddler=<<template>>>
|
||||||
|
<h1><<_itemTemplate>></h1>
|
||||||
|
<$transclude mode="block"><<missingText>></$transclude>
|
||||||
|
</$transclude>
|
||||||
|
</$reveal>
|
||||||
|
<$reveal stateTitle=<<selectedTiddler>> type="match" text="">
|
||||||
|
<<unselectedText>>
|
||||||
|
</$reveal>
|
||||||
</div>
|
</div>
|
||||||
</$linkcatcher>
|
|
||||||
<div class="tc-tabbed-table-of-contents-content">
|
|
||||||
<$reveal stateTitle=<<selectedTiddler>> type="nomatch" text="">
|
|
||||||
<$transclude mode="block" tiddler=<<template>>>
|
|
||||||
<h1><<_itemTemplate>></h1>
|
|
||||||
<$transclude mode="block"><<missingText>></$transclude>
|
|
||||||
</$transclude>
|
|
||||||
</$reveal>
|
|
||||||
<$reveal stateTitle=<<selectedTiddler>> type="match" text="">
|
|
||||||
<<unselectedText>>
|
|
||||||
</$reveal>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</$tiddler>
|
||||||
</$tiddler>
|
</$let>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
<!-- ========================================================
|
<!-- ========================================================
|
||||||
@ -464,19 +477,21 @@ 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>] }}} >
|
||||||
<$macrocall $name="toc-tabbed-external-nav"
|
<$linkcatcher to=<<selectedTiddler>>>
|
||||||
tag=<<tag>>
|
<$macrocall $name="toc-tabbed-external-nav"
|
||||||
sort=<<sort>>
|
tag=<<tag>>
|
||||||
selectedTiddler=<<selectedTiddler>>
|
sort=<<sort>>
|
||||||
unselectedText=<<unselectedText>>
|
selectedTiddler=<<selectedTiddler>>
|
||||||
missingText=<<missingText>>
|
unselectedText=<<unselectedText>>
|
||||||
template=<<template>>
|
missingText=<<missingText>>
|
||||||
exclude=<<exclude>>
|
template=<<template>>
|
||||||
captionField=<<captionField>>
|
exclude=<<exclude>>
|
||||||
tagField=<<tagField>>
|
captionField=<<captionField>>
|
||||||
parentField=<<parentField>>
|
tagField=<<tagField>>
|
||||||
itemTemplate=<<itemTemplate>>
|
parentField=<<parentField>>
|
||||||
/>
|
itemTemplate=<<itemTemplate>>
|
||||||
</$linkcatcher>
|
/>
|
||||||
|
</$linkcatcher>
|
||||||
|
</$let>
|
||||||
\end
|
\end
|
||||||
|
Loading…
Reference in New Issue
Block a user