From 58c81598b501b67cb85bde7d6be4e7dfc3cfb759 Mon Sep 17 00:00:00 2001 From: pmario Date: Wed, 7 Feb 2024 12:45:12 +0100 Subject: [PATCH] add all new fields to all toc-macros. rename some internal variables --- core/wiki/macros/toc.tid | 138 +++++++++++++++++++++------------------ 1 file changed, 73 insertions(+), 65 deletions(-) diff --git a/core/wiki/macros/toc.tid b/core/wiki/macros/toc.tid index fbcad01a3..06c32852b 100644 --- a/core/wiki/macros/toc.tid +++ b/core/wiki/macros/toc.tid @@ -18,7 +18,7 @@ tags: $:/tags/Macro \function tf.toc-getItemTemplate() [!is[blank]then] :else[get[toc-itemTemplate]] -\procedure toc-itemTemplate() +\procedure _itemTemplate() <$transclude $tiddler=<> > <> @@ -28,9 +28,9 @@ tags: $:/tags/Macro \procedure toc-open-icon() $:/core/images/down-arrow \procedure toc-closed-icon() $:/core/images/right-arrow -\procedure toc-hide-field() toc-hide -\procedure toc-include-field() toc-include -\procedure toc-filter-field() toc-filter +\procedure toc-hideField() toc-hide +\procedure toc-includeField() toc-include +\procedure toc-filterField() toc-filter \function tf.toc-itemClassFilter() [get[text]matchthen[toc-item-selected]else[toc-item]] @@ -41,14 +41,14 @@ tags: $:/tags/Macro \function tf.toc-itemClass() [] [] [] [] +[join[ ]] -\function tf.toc-getHideText() [get] +\function tf.toc-getHideText() [get] \function tf.toc-hideIsYes() [format:titlelist[]] \function tf.toc-hide() [match[yes]then] :else[] -\function tf.toc-include() [get] -\function tf.toc-filter() [get] +\function tf.toc-include() [get] +\function tf.toc-filter() [get] \procedure toc-filterDefault() [all[shadows+tiddlers]tag!has[draft.of]] @@ -76,16 +76,16 @@ tags: $:/tags/Macro <$set name="_excluded" filter="[subfilter] [] [subfilter]">
  • >> <% if [all[current]toc-link[no]] %> - <> + <<_itemTemplate>> <% else %> <$link to={{{ [get[target]else] }}}> - <> + <<_itemTemplate>> <% endif %> - <$macrocall - $name="toc-body" - tag=<> exclude=<<_excluded>> path=<<_path>> + + + <$macrocall $name="toc-body" tag=<> exclude=<<_excluded>> path=<<_path>> />
  • @@ -93,6 +93,7 @@ tags: $:/tags/Macro <% endif %> + \end @@ -109,22 +110,22 @@ v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter \procedure toc-item(isUnlinked:"") <% if [get[text]else[close]match[close]] %> <$button setTitle=<> setTo="open" class="tc-btn-invisible tc-popup-keep" tooltip=<>> <$transclude tiddler=<> /> <% if [match[yes]] %> - <> + <<_itemTemplate>> <% endif %> <% elseif [get[text]match[open]] %> <$button setTitle=<> setTo="close" class="tc-btn-invisible tc-popup-keep" tooltip=<>> <$transclude tiddler=<> /> <% if [match[yes]] %> - <> + <<_itemTemplate>> <% endif %> <% endif %> @@ -132,36 +133,36 @@ v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter \function tf.toc-stateTitle() [[$:/state/toc]] [] "/" [] +[join[]] -\procedure toc-linked-expandable-body(tag,sort:"",itemClassFilter,exclude,path,captionField,itemTemplate) +\procedure toc-linked-expandable-body(tag,sort:"",itemClassFilter,exclude,path,tagField,parentField,captionField,itemTemplate) <$qualify name="toc-state" title=<> >
  • >> <$link to={{{ [get[target]else] }}}> <> - <> + <<_itemTemplate>> <% if [get[text]match[open]] %> - <$macrocall - $name="toc-expandable" + <$macrocall $name="toc-expandable" tag=<> sort=<> exclude=<> path=<> - captionField=<> itemTemplate=<> + tagField=<> parentField=<> captionField=<> + itemTemplate=<> /> <% endif %>
  • \end -\procedure toc-unlinked-expandable-body(tag,sort:"",itemClassFilter,exclude,path,captionField,itemTemplate) +\procedure toc-unlinked-expandable-body(tag,sort:"",itemClassFilter,exclude,path,tagField,parentField,captionField,itemTemplate) <$qualify name="toc-state" title=<>>
  • >> <> <% if [get[text]match[open]] %> - <$macrocall - $name="toc-expandable" + <$macrocall $name="toc-expandable" tag=<> sort=<> exclude=<> path=<> - captionField=<> itemTemplate=<> + tagField=<> parentField=<> captionField=<> + itemTemplate=<> /> <% endif %>
  • @@ -171,26 +172,27 @@ v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter -\procedure toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path, captionField, itemTemplate) +\procedure toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path,tagField,parentField,captionField,itemTemplate) +<$set name=currentTiddler filter="[!is[blank]thenelse]">
      <$list filter=` [subfilter] - :else[all[shadows+tiddlers]tag!has[draft.of]$(sort)$] + :else[subfilter$(sort)$] [subfilter] -[] -[subfilter]`> <%if [] -[subfilter] %> <$let _path=<>> <$set name="_excluded" filter="[subfilter] [] [subfilter]"> <% if [all[current]toc-link[no]] %> - <$macrocall - $name="toc-unlinked-expandable-body" + <$macrocall $name="toc-unlinked-expandable-body" tag=<> sort=<> exclude=<<_excluded>> path=<<_path>> - captionField=<> itemTemplate=<> + tagField=<> parentField=<> captionField=<> + itemTemplate=<> /> <% else %> - <$macrocall - $name="toc-linked-expandable-body" + <$macrocall $name="toc-linked-expandable-body" tag=<> sort=<> exclude=<<_excluded>> path=<<_path>> - captionField=<> itemTemplate=<> + tagField=<> parentField=<> captionField=<> + itemTemplate=<> /> <% endif %> @@ -198,56 +200,62 @@ Shows an expandable toc. Item always have an open/close chevron <% endif %>
    + \end -\function tf.toc-curTidInclude() [get] +\function tf.toc-curTidInclude() [get] -\procedure toc-linked-selective-expandable-body(tag,sort:"",itemClassFilter,exclude,path,captionField,itemTemplate) +\procedure toc-linked-selective-expandable-body(tag,sort:"",itemClassFilter,exclude,path,tagField,parentField,captionField,itemTemplate) <$qualify name="toc-state" title=<>>
  • >> <$link to={{{ [get[target]else] }}}> - <% if [all[current]tagging[]] [subfilter] -[subfilter] +[limit[1]] %> + <% if [has] :filter[getmatch<..currentTiddler>] +[limit[1]] %> + <> + <% elseif [all[current]tagging[]] [subfilter] -[subfilter] +[limit[1]] %> <> <% else %> <$button class='tc-btn-invisible'> {{$:/core/images/blank}} <% endif %> - <> + <<_itemTemplate>> <% if [get[text]match[open]] %> - <$macrocall - $name="toc-selective-expandable" + <$macrocall $name="toc-selective-expandable" tag=<> sort=<> exclude=<> path=<> - captionField=<> itemTemplate=<> + tagField=<> parentField=<> captionField=<> + itemTemplate=<> + /> <% endif %>
  • \end -\procedure toc-unlinked-selective-expandable-body(tag,sort:"",itemClassFilter,exclude,path,captionField,itemTemplate) +\procedure toc-unlinked-selective-expandable-body(tag,sort:"",itemClassFilter,exclude,path,tagField,parentField,captionField,itemTemplate) <$qualify name="toc-state" title=<> >
  • >> - <% if [all[current]tagging[]] [subfilter] -[subfilter] +[limit[1]] %> + <% if [has] :filter[getmatch<..currentTiddler>] +[limit[1]] %> + <> + <% elseif [all[current]tagging[]] [subfilter] -[subfilter] +[limit[1]] %> <> <% else %> <$button class="tc-btn-invisible"> {{$:/core/images/blank}} - <> + <<_itemTemplate>> <% endif %> <% if [get[text]match[open]] %> - <$macrocall - $name="toc-selective-expandable" + <$macrocall $name="toc-selective-expandable" tag=<> sort=<> exclude=<> path=< - captionField=<> itemTemplate=<> + tagField=<> parentField=<> captionField=<> + itemTemplate=<> /> <% endif %>
  • @@ -258,26 +266,27 @@ Shows an expandable toc. Item always have an open/close chevron 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,itemTemplate) +\procedure toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path,tagField,parentField,captionField,itemTemplate) +<$set name=currentTiddler filter="[!is[blank]thenelse]">
      <$list filter=` [subfilter] - :else[all[shadows+tiddlers]tag!has[draft.of]$(sort)$] + :else[subfilter$(sort)$] [subfilter] -[] -[subfilter]`> <%if [] -[subfilter] %> <$let _path=<>> <$set name="_excluded" filter="[subfilter] [] [subfilter]"> <% if [all[current]toc-link[no]] %> - <$macrocall - $name="toc-unlinked-selective-expandable-body" + <$macrocall $name="toc-unlinked-selective-expandable-body" tag=<> sort=<> exclude=<<_excluded>> path=<<_path>> - captionField=<> itemTemplate=<> + tagField=<> parentField=<> captionField=<> + itemTemplate=<> /> <% else %> - <$macrocall - $name="toc-linked-selective-expandable-body" + <$macrocall $name="toc-linked-selective-expandable-body" tag=<> sort=<> exclude=<<_excluded>> path=<<_path>> - captionField=<> itemTemplate=<> + tagField=<> parentField=<> captionField=<> + itemTemplate=<> /> <% endif %> @@ -285,24 +294,22 @@ If an item has no children, there is no open/close chevron <% endif %>
    + \end -\procedure toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude, captionField, itemTemplate) +\procedure toc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",exclude,tagField,parentField,captionField,itemTemplate) <$tiddler tiddler={{{ [get[text]] }}}>
    <$linkcatcher to=<>>
    - <$macrocall - $name="toc-selective-expandable" - tag=<> - sort=<> - exclude=<> - captionField=<> + <$macrocall $name="toc-selective-expandable" + tag=<> sort=<> exclude=<> + tagField=<> parentField=<> captionField=<> itemTemplate=<> />
    @@ -310,7 +317,7 @@ If a toc-item link is clicked it will open the tiddler in the story
    <$reveal stateTitle=<> type="nomatch" text=""> <$transclude mode="block" tiddler=<