[tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-09 Thread 'c pa' via TiddlyWiki
Linus, Use something like this. It's a call to a macro that recursively calls itself. \define listChildren(tag) <$list filter="[tag[$tag$]]"> <$view field="title"/> <$macrocall $name="listChildren" tag=<> /> \end !Top <$macrocall $name="listChildren"

[tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-15 Thread Tobias Beer
This begs for a solution similar to *x-plore* [1] for TW2, which... - only indexes any tiddler once - excludes tiddlers from being indexed - truncates the output tree at specified tiddlers Please excuse the non-commented spaghetti code from back then. In short, I don't think the core pr

[tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2016-05-05 Thread Majid al-Dosari
these kinds of things are now pretty much solved with the wikify widget https://github.com/Jermolene/TiddlyWiki5/issues/2337 I fired up my tw from source and i now can construct recursive macros to generate filters and then have their output (through a wikify) go in a filter attribute of whatev

Re: [tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-10 Thread Linus Johnsson
Dear c pa, Thank you for your kind advice. Your code does what it is supposed to, of course. But since many of my tiddlers contain spaces, the resulting list will not work as a filter. (I need to perform a second filter run on the results rather than putting all the functionality in the macro, for

Re: [tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-10 Thread Evan Balster
http://tiddlywiki.com/static/TextWidget.html <$text text="[["/><$view field="title"/><$text text="]]">> There might be a simpler way, but this works. ...So you're rendering this all to a string for use as a parameter to another filter? If you manage that, I'm *very* curious as to how. (I've

Re: [tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-10 Thread 'c pa' via TiddlyWiki
Linus, Ahhh, the old create a list and then parse it trick. I have done that before. I think what I ended up doing is storing the list in a temporary tiddler's list and then parsing that list to get the results You can use [ and ] to create square brackets So something like [[<$view field="ti

Re: [tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-12 Thread Linus Johnsson
Thank you for your kind replies. Both suggestions rendered brackets just fine. As you seem to have anticipated, this immediately landed me in a different kind of problem. I defined the following macro: \define listDescendants(tag) <$list filter="[tag[$tag$]tag[concepts]]"> [[<$view fie

Re: [tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-12 Thread Evan Balster
A few notes: 1) Macros always have to be at the top of the file, before any WikiText. 2) The syntax $(variable)$ only applies inside macros. Outside macros, use <>. 3) Your trick isn't working because there's no way to *render* WikiText into a filter expression. Basically, the code inside <>

Re: [tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-13 Thread Linus Johnsson
Through your suggestions I have made at least some progress. Given the code \define listDescendants(tag) [[$tag$]] <$list filter="[tag[$tag$]tag[concepts]]"> [[<$view field="title" />]] <$macrocall $name="listDescendants" tag=<> /> \end \define myMacro() <$set name="m

Re: [tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-13 Thread Evan Balster
Here's an approach which doesn't require assembling an intermediate list. Like my last example, this is most easily demonstrated by creating a new tiddler on TiddlyWiki.com and previewing it. \define heirarchy_sub() <$list filter="[tag{!!title}]"> <$link>{{!!title}} <$macrocall $name="heira

Re: [tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-15 Thread Linus Johnsson
Dear Evan, Thanks for clarifying. It all makes sense to me now. I wonder how long I will be able to remember these distinctions though! I have defined a macro that seems to be quite close to what you are suggesting: \define traverseDescendants(tag, displayMacro) <$list filter="[tag[$tag$]tag

Re: [tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-15 Thread Linus Johnsson
I just noticed that the above code does not call displayMacro for the root. This does the trick though: \define traverseDescendants(tag, displayMacro) <$tiddler tiddler="$tag$"> <$macrocall $name="$displayMacro$" /> <$list filter="[tag[$tag$]tag[§begrepp]]"> <$macrocal

Re: [tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-15 Thread Linus Johnsson
Evan and Tobias, after having done some thinking, I have finally decided that I agree with you. Without js, we seem to have hit a brick wall. (I could of course have just trusted you on this, but felt compelled to discover it for myself.) Tobias, your plugin seems to be a good start. If I am not m

Re: [tw] Re: [TW5] Get list of descendants by recursively assembling filter?

2015-09-15 Thread Tobias Beer
> > Tobias, your plugin seems to be a good start. If I am not mistaken, it > would need to be modified slightly to do what I want. Specifically, I would > need it to have another filter parameter that specifies tiddlers to be > traversed but not indexed. > Not sure I understand this part. Can