1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-05 15:00:27 +00:00

change possible fields to: toc-hide, toc-override and toc-include

This commit is contained in:
pmario 2024-02-04 21:57:34 +01:00
parent 141f8029dc
commit e884c1178c

View File

@ -20,19 +20,20 @@ tags: $:/tags/Macro
<!-- helper functions for li class definitions -->
\function tf.toc-itemClassFilter() [<selectedTiddler>get[text]match<currentTiddler>then[toc-item-selected]else[toc-item]]
\function tf.toc-includedClass() [subfilter<tf.toc-include>match<currentTiddler>then[toc-item-included]]
\function tf.toc-excludedClass() [<tf.toc-exclude>!is[blank]then[toc-item-excluded]]
\function tf.toc-hideClass() [<tf.toc-hide>!is[blank]then[toc-item-excluded]]
<!-- join the CSS definitions from above -->
\function tf.toc-itemClass() [<tf.toc-itemClassFilter>] [<tf.toc-includedClass>] [<tf.toc-excludedClass>] +[join[ ]]
\function tf.toc-itemClass() [<tf.toc-itemClassFilter>] [<tf.toc-includedClass>] [<tf.toc-hideClass>] +[join[ ]]
<!-- the following 3 functions need to use <currentTiddler> -->
\function tf.toc-getExcludeText() [<currentTiddler>get[toc-exclude]]
\function tf.toc-excludeIsYes() [<currentTiddler>format:titlelist[]]
\function tf.toc-getHideText() [<currentTiddler>get[toc-hide]]
\function tf.toc-hideIsYes() [<currentTiddler>format:titlelist[]]
<!-- Special case, if toc-exclude field is "yes", we need a currentTiddler *titlelist* -- otherwise return the content as text -->
\function tf.toc-exclude() [<tf.toc-getExcludeText>match[yes]then<tf.toc-excludeIsYes>] :else[<tf.toc-getExcludeText>]
<!-- Special case, if toc-hide field is "yes", we need a currentTiddler *titlelist* -- otherwise return the content as text -->
\function tf.toc-hide() [<tf.toc-getHideText>match[yes]then<tf.toc-hideIsYes>] :else[<tf.toc-getHideText>]
<!-- tf.toc-include needs to use <tag> -->
<!-- tf.toc-include and tf.toc-override need to use <tag> -->
\function tf.toc-include() [<tag>get[toc-include]]
\function tf.toc-override() [<tag>get[toc-override]]
<!-- define unique path based state title -->
\function tf.toc-newPath() [<path>addsuffix[/]addsuffix<tag>]
@ -40,14 +41,13 @@ tags: $:/tags/Macro
\procedure toc-body(tag,sort:"",itemClassFilter,exclude,path)
<ol class="tc-toc">
<!-- text substitution is needed for backwards compatibility -->
<!-- <$list filter=`[all[shadows+tiddlers]tag<tag>!has[draft.of]$(sort)$] [subfilter<tf.toc-include>] -[<tag>] -[subfilter<exclude>]`> -->
<$list filter=` [subfilter<tf.toc-include>]
<$list filter=` [subfilter<tf.toc-override>]
:else[all[shadows+tiddlers]tag<tag>!has[draft.of]$(sort)$]
-[<tag>] -[subfilter<exclude>]`>
<%if [<currentTiddler>] -[subfilter<tf.toc-exclude>] %>
[subfilter<tf.toc-include>] -[<tag>] -[subfilter<exclude>]`>
<%if [<currentTiddler>] -[subfilter<tf.toc-hide>] %>
<$let item=<<currentTiddler>> __path=<<tf.toc-newPath>> >
<!-- adding tf.toc-exclude, excludes blocked elements from all visible sub-nodes -->
<$set name="__excluded" filter="[subfilter<exclude>] [<tag>] [subfilter<tf.toc-exclude>]">
<!-- adding tf.toc-hide, excludes blocked elements from all visible sub-nodes -->
<$set name="__excluded" filter="[subfilter<exclude>] [<tag>] [subfilter<tf.toc-hide>]">
<li class=<<tf.toc-itemClass>>>
<% if [all[current]toc-link[no]] %>
<<toc-caption>>
@ -142,13 +142,12 @@ Shows an expandable toc. Item always have an open/close chevron
\procedure toc-expandable(tag,sort:"",itemClassFilter:"",exclude,path)
<ol class="tc-toc toc-expandable">
<!-- text substitution is needed for backwards compatibility -->
<!-- <$list filter=`[all[shadows+tiddlers]tag<tag>!has[draft.of]$(sort)$] [subfilter<tf.toc-include>] -[<tag>] -[subfilter<exclude>]`> -->
<$list filter=` [subfilter<tf.toc-include>]
<$list filter=` [subfilter<tf.toc-override>]
:else[all[shadows+tiddlers]tag<tag>!has[draft.of]$(sort)$]
-[<tag>] -[subfilter<exclude>]`>
<%if [<currentTiddler>] -[subfilter<tf.toc-exclude>] %>
[subfilter<tf.toc-include>] -[<tag>] -[subfilter<exclude>]`>
<%if [<currentTiddler>] -[subfilter<tf.toc-hide>] %>
<$let __path=<<tf.toc-newPath>>>
<$set name="__excluded" filter="[subfilter<exclude>] [<tag>] [subfilter<tf.toc-exclude>]">
<$set name="__excluded" filter="[subfilter<exclude>] [<tag>] [subfilter<tf.toc-hide>]">
<% if [all[current]toc-link[no]] %>
<$macrocall
$name="toc-unlinked-expandable-body"
@ -226,13 +225,12 @@ If an item has no children, there is no open/close chevron
\procedure toc-selective-expandable(tag,sort:"",itemClassFilter,exclude,path)
<ol class="tc-toc toc-selective-expandable">
<!-- text substitution is needed for backwards compatibility -->
<!-- <$list filter=`[all[shadows+tiddlers]tag<tag>!has[draft.of]$(sort)$] [subfilter<tf.toc-include>] -[<tag>] -[subfilter<exclude>]`> -->
<$list filter=` [subfilter<tf.toc-include>]
<$list filter=` [subfilter<tf.toc-override>]
:else[all[shadows+tiddlers]tag<tag>!has[draft.of]$(sort)$]
-[<tag>] -[subfilter<exclude>]`>
<%if [<currentTiddler>] -[subfilter<tf.toc-exclude>] %>
[subfilter<tf.toc-include>] -[<tag>] -[subfilter<exclude>]`>
<%if [<currentTiddler>] -[subfilter<tf.toc-hide>] %>
<$let __path=<<tf.toc-newPath>>>
<$set name="__excluded" filter="[subfilter<exclude>] [<tag>] [subfilter<tf.toc-exclude>]">
<$set name="__excluded" filter="[subfilter<exclude>] [<tag>] [subfilter<tf.toc-hide>]">
<% if [all[current]toc-link[no]] %>
<$macrocall
$name="toc-unlinked-selective-expandable-body"