On Thursday, October 4, 2018 at 7:35:18 AM UTC-7, Mark S. wrote:
>
> It turns out there is an undocumented "exclude" option, so if you can try 
> that method if you want and see if it works better.
>

Some years ago, when the TOC macros were first written, they had a problem 
with infinite recursion if a tiddler was tagged with the tag of a "parent 
node" in the tree.

To address this, I added an *internal* variable, "exclude", that is used 
during the recursion to automatically keep track of which tiddlers have 
already been listed in the tree, so that they won't get displayed more than 
once and create circular references.  The value of the exclude param is a 
"negative filter"... that is, it uses TW filter syntax to remove matching 
titles from consideration, like this: "-[[SomeTitle]]".  As the recursion 
progresses, more titles are added...e.g., "-[[Foo]] -[[Bar]] -[[Baz]]".

Normally, when invoking a TOC macro, the "exclude" filter value defaults to 
blank, so that all tiddlers in the tree will be shown.  However, if you DO 
provide an initial filter value for the exclude param, any titles matching 
that filter will be suppressed without being displayed even once.  Thus, 
you can use exclude="-[tag[Gronk]]".

Important note: every term in the exclude filter MUST be a negated term 
(with the "-" prefix) or it will CAUSE infinite recursion.  For example, if 
you write exclude="[tag[Foo]]" instead of exclude="-[tag[Foo]]", then all 
tiddlers tagged "Foo" will be treated as matching tiddlers at *every* level 
of the tree and the code will recurse until the browser crashes.

It's just too easy to break things just by missing a single leading "-" on 
any filter term.  Perhaps for this reason more than anything else, the 
variable -- while necessary for internally preventing infinite recursion -- 
is not documented for general use as an input param.

-e

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6e6dbc92-b529-441d-b393-3411eb61f970%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to