Filter expression to find namespace children of current tiddler

I’m trying to construct a template inside which I would like to find all tiddlers that are “namespace children” of the current tiddler, or inside it, if the titles were interpreted as paths. So e.g. if the current tiddler is named John, then I would like to construct a filter that finds John/Photo, John/Photo 2, and John/Files/Document, but not John Doe/Something.

This is equal to filter [all[tiddlers]prefix[John/]], however, I’m unable to find a way to have the parameter of the prefix operator “variable”, so that it always is current tiddler (or ideally, any arbitrarily defined tiddler) followed by / (or again ideally, any arbitrarily defined separator).

I was hoping for something like [<currentTiddler>addsuffix[/]] :map[all[tiddlers]prefix<currentTiddler>], but the map filter prefix returns only the first result, not all.

I got it to work using this code:

<$let pref={{{ [<currentTiddler>addsuffix[/]] }}}>
{{{ [all[tiddlers]prefix<pref>] }}}
</$let>

but I was wondering if there is some way to do it using only a clever filter expression, without the variable.

Try using map:flat[prefix<currentTiddler>]

2 Likes

Thanks! I have missed the flat option.