mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-31 15:42:59 +00:00 
			
		
		
		
	use currentTiddler as tag default parameter if it is missing
This commit is contained in:
		| @@ -26,6 +26,9 @@ 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() | ||||||
|  | <%if [<_mode>match[tagMode][toc-caption]is[variable]] %> | ||||||
|  | 	<$transclude $variable="toc-caption"/> | ||||||
|  | <%else%> | ||||||
| 	<$let tv-wikilinks="no" | 	<$let tv-wikilinks="no" | ||||||
| 		field={{{ [<currentTiddler>] :cascade[<_hasItemTemplate>append<_hasCaptionField>append<_hasCaption>append[title]] }}} | 		field={{{ [<currentTiddler>] :cascade[<_hasItemTemplate>append<_hasCaptionField>append<_hasCaption>append[title]] }}} | ||||||
| 	> | 	> | ||||||
| @@ -39,6 +42,7 @@ The very first toc macro is _not_ reused. So it can be used as a simple referenc | |||||||
| 		<!-- 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,6 +301,7 @@ 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) | ||||||
|  | <$let tag={{{ [<tag>is[blank]then<currentTiddler>else<tag>] }}} > | ||||||
| 	<$set name=currentTiddler filter="[<parentField>!is[blank]then<tag>else<currentTiddler>]"> | 	<$set name=currentTiddler filter="[<parentField>!is[blank]then<tag>else<currentTiddler>]"> | ||||||
| 		<ol class="tc-toc toc-expandable"> | 		<ol class="tc-toc toc-expandable"> | ||||||
| 			<!-- Text substitution is needed for backwards compatibility --> | 			<!-- Text substitution is needed for backwards compatibility --> | ||||||
| @@ -322,6 +330,7 @@ Shows an expandable toc. Item always have an open/close chevron | |||||||
| 			</$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,6 +406,7 @@ 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) | ||||||
|  | <$let tag={{{ [<tag>is[blank]then<currentTiddler>else<tag>] }}} > | ||||||
| 	<$set name=currentTiddler filter="[<parentField>!is[blank]then<tag>else<currentTiddler>]"> | 	<$set name=currentTiddler filter="[<parentField>!is[blank]then<tag>else<currentTiddler>]"> | ||||||
| 		<ol class="tc-toc toc-selective-expandable"> | 		<ol class="tc-toc toc-selective-expandable"> | ||||||
| 			<!-- text substitution is needed for backwards compatibility --> | 			<!-- text substitution is needed for backwards compatibility --> | ||||||
| @@ -425,6 +435,7 @@ If an item has no children, there is no open/close chevron | |||||||
| 			</$list> | 			</$list> | ||||||
| 		</ol> | 		</ol> | ||||||
| 	</$set> | 	</$set> | ||||||
|  | </$let> | ||||||
| \end | \end | ||||||
|  |  | ||||||
| <!-- ==================================================================== | <!-- ==================================================================== | ||||||
| @@ -432,6 +443,7 @@ 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) | ||||||
|  | <$let tag={{{ [<tag>is[blank]then<currentTiddler>else<tag>] }}} > | ||||||
| 	<$tiddler tiddler={{{ [<selectedTiddler>get[text]] }}}> | 	<$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>>> | ||||||
| @@ -457,6 +469,7 @@ If a toc-item link is clicked it will open the tiddler in the story river | |||||||
| 			</div> | 			</div> | ||||||
| 		</div> | 		</div> | ||||||
| 	</$tiddler> | 	</$tiddler> | ||||||
|  | </$let> | ||||||
| \end | \end | ||||||
|  |  | ||||||
| <!-- ======================================================== | <!-- ======================================================== | ||||||
| @@ -464,6 +477,7 @@ 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) | ||||||
|  | <$let tag={{{ [<tag>is[blank]then<currentTiddler>else<tag>] }}} > | ||||||
| 	<$linkcatcher to=<<selectedTiddler>>> | 	<$linkcatcher to=<<selectedTiddler>>> | ||||||
| 		<$macrocall $name="toc-tabbed-external-nav" | 		<$macrocall $name="toc-tabbed-external-nav" | ||||||
| 			tag=<<tag>> | 			tag=<<tag>> | ||||||
| @@ -479,4 +493,5 @@ it will open the tiddler in the view area of the same tiddler | |||||||
| 			itemTemplate=<<itemTemplate>> | 			itemTemplate=<<itemTemplate>> | ||||||
| 		/> | 		/> | ||||||
| 	</$linkcatcher> | 	</$linkcatcher> | ||||||
|  | </$let> | ||||||
| \end | \end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 pmario
					pmario