1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-07 07:50:26 +00:00

toc-exclude works, but should be improved

This commit is contained in:
pmario 2024-02-03 03:04:41 +01:00
parent bdb5161f75
commit 745c7fbbcd

View File

@ -25,31 +25,45 @@ tags: $:/tags/Macro
</span> </span>
\end \end
<!-- tf.toc-include needs to use <tag> -->
\function tf.toc-include() [<tag>get[toc-include]]
<!-- the following functions need to use <currentTiddler> -->
\function tf.toc-exclude() [<currentTiddler>get[toc-exclude]]
\function tf.toc-excludeYes() [<currentTiddler>format:titlelist[]]
\procedure toc-body(tag,sort:"",itemClassFilter,exclude,path) \procedure toc-body(tag,sort:"",itemClassFilter,exclude,path)
<ol class="tc-toc"> <ol class="tc-toc">
<!-- text substitution is needed for backwards compatibility --> <!-- text substitution is needed for backwards compatibility -->
<$list filter=`[all[shadows+tiddlers]tag<tag>!has[draft.of]$(sort)$] -[<tag>] -[subfilter<exclude>]`> <$list filter=`[all[shadows+tiddlers]tag<tag>!has[draft.of]$(sort)$] [subfilter<tf.toc-include>] -[<tag>] -[subfilter<exclude>]`>
<$let item=<<currentTiddler>> __path=<<tf.toc-newPath>> > <$let _toc-exclude={{{ [<tf.toc-exclude>match[yes]then<tf.toc-excludeYes>] :else[<tf.toc-exclude>] }}} >
<$set name="__excluded" filter="[subfilter<exclude>] [<tag>]"> <%if [<currentTiddler>] -[subfilter<_toc-exclude>] %>
<li class=<<tf.toc-getItemClass>>> <$let item=<<currentTiddler>> _path=<<tf.toc-newPath>> >
<% if [all[current]toc-link[no]] %> <$set name="_excluded" filter="[subfilter<exclude>] [<tag>] [subfilter<_toc-exclude>]">
<<toc-caption>> <li class=<<tf.toc-getItemClass>>>
<% else %> <% if [all[current]toc-link[no]] %>
<!-- v5.1.23 use target-field if present in tiddler --> <<toc-caption>>
<$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}> <% else %>
<<toc-caption>> <!-- v5.1.23 use target-field if present in tiddler -->
</$link> <$link to={{{ [<currentTiddler>get[target]else<currentTiddler>] }}}>
<% endif %> <<toc-caption>>
<$macrocall </$link>
$name="toc-body" <% endif %>
tag=<<item>> sort=<<sort>> itemClassFilter=<<itemClassFilter>> exclude=<<__excluded>> path=<<__path>> <$macrocall
/> $name="toc-body"
</li> tag=<<item>> sort=<<sort>> itemClassFilter=<<itemClassFilter>> exclude=<<_excluded>> path=<<_path>>
</$set> />
</li>
</$set>
</$let>
<% endif %>
</$let> </$let>
</$list> </$list>
</ol> </ol>
\end \end
<!-- log -->
<!-- <$log tag=<<tag>> _t-e=<<_toc-exclude>> ct=<<currentTiddler>> sub={{{ [subfilter<_toc-exclude>]}}} exclude=<<exclude>>/> -->
<!-- log -->
<!-- ======================================= <!-- =======================================
Simple toc macro which shows the full tree Simple toc macro which shows the full tree