sits
February 21, 2025, 7:16am
1
As an experiment, I loaded up https://tiddlywiki.com/ , changed the TableOfContents tiddler to have this:
<div class="tc-table-of-contents">
<<toc-selective-expandable 'TableOfContents' exclude:'[tag[done]]'>>
</div>
I then changed the Videos tiddler to have tag “done”. While this excluded the Videos tiddler under the Learning tiddler in the Contents tab, the “expandable arrow” disappears too, which seems like a bug?
If I remove the exclude clause (or the “done” tag), then it reverts correctly and the “expandable arrow” is back on the Learning tiddler title.
pmario
February 21, 2025, 10:29am
2
That’s a known bug. There is no existing fix atm.
Try my TiddlyTools alternative <<toc-tree>> macro (see TiddlyTools/TOC )
<div class="tc-table-of-contents">
<<toc-tree 'TableOfContents' exclude:'[tag[done]]'>>
</div>
The logic for when to show/hide the “expandable arrow” is defined in toc-toggle-item() and uses this filter:
<$list filter="[contains:$(field)$<item>] [list<item>] -[subfilter<exclude>] -[<item>] +[!has[draft.of]limit[1]]">
and correctly shows the arrow as long as at least one child item is contained in the branch.
I think that the bug in the TWCore’s <<toc-selective-expandable>> macro occurs in toc-linked-selective-expandable-body() in the filter on this line:
<$list filter="[all[current]tagging[]$sort$limit[1]] -[subfilter<__exclude__>]" ...
If this is changed to
<$list filter="[all[current]tagging[]$sort$] -[subfilter<__exclude__>] +[limit[1]]" ...
(i.e., so the exclusion is done before the limit[1] is applied), then it seems to fix the problem. Note that this same filter logic is also used in toc-unlinked-selective-expandable-body(), so that code would also need to be adjusted.
-e
pmario
February 21, 2025, 3:54pm
4
sits
February 21, 2025, 11:34pm
6
Many thanks all for fixing this.