Hi all, thanks for the comments. I was careful about tagging, not to create tag loops, but I can see how that would be a problem. You'd have the same problem with the TOC macros – which are recursive – though, wouldn't you (at least with the types that are always fully expanded)? If Mark is right that would at least explain why TW would always run into a recursion error, no matter if there even are *any* tagged tiddlers. The filter would recurse indefinitely during setup. However, the numbered subfilters are not really pretty. I cannot use macros as Soren proposed since I need to store the whole tagging tree in a variable for later use in an :intersection filter. If there at least was a way to integrate a counter into the recursion, one could make it stop after a flexible number of iterations, which number could be passed into the filter expression via a variable. Right now,I resorted to just create a single, long filter expression and stopped after 3 levels. To add another level, I need to modify the filter expression itself, though.
Yaisog On Monday, April 19, 2021 at 7:41:48 PM UTC+2 [email protected] wrote: > About recursive macro, they may be possible, but the problem is how to > stop the recursion. Your example works if there is no loop created by > tagging. > > The problem is we don't have a proper <<if>> macro to decide what to do > (control recursion call in that case). Or how do you do that? > > Le dimanche 18 avril 2021 à 21:36:33 UTC+2, Soren Bjornstad a écrit : > >> I've never tried to do a recursive* filter*, so I don't know what's >> technically possible (though I've never seen someone try to use multiple >> filter runs in *subfilter* and am a bit suspicious that the second run >> is doing a tagging[] on everything in your wiki). But recursive macros are >> easy and functional, and I suspect they'll work for your use case. Here's >> one version that does an outline of the TOC on tiddlywiki.com, using the >> current tiddler to easily pass the state through to the next level: >> >> \define recurse() >> <$list filter="[all[current]tagging[]]"> >> <li><<currentTiddler>><ul> >> <<recurse>></ul></li> >> </$list> >> \end >> >> <$tiddler tiddler="TableOfContents"> >> <ul> >> <<recurse>> >> </ul> >> </$tiddler> >> >> On Sunday, April 18, 2021 at 2:01:51 PM UTC-5 Yaisog Bonegnasher wrote: >> >>> Hi, >>> I recently tried to create a recursive subfilter to find all tiddlers >>> below a certain tag, no matter how many levels deep (similar to the >>> *kin* filter, which is too slow for my large wiki). Unfortunately, I >>> was greeted with a red-message-box-of-death informing me of too much >>> recursion. However, there should only be a couple of levels. >>> Are recursive filters at all possible or am I doing something wrong? >>> For a quick example, try this in a new tiddler on tiddlywiki.com: >>> \define subfilter-test() [tagging[]] [tagging[]subfilter<subfilter-test>] >>> >>> <$set name="test" filter="[[TableOfContents]subfilter<subfilter-test>]"> >>> <$list filter="=[enlist<test>]" template="$:/core/ui/ListItemTemplate" >>> /> >>> </$set> >>> Any enlightment is greatly appreciated. >>> Best regards >>> Yaisog >>> >> -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/aa7a46a7-0dd4-4b10-8d48-7c8f88a5a8e7n%40googlegroups.com.

