Filter to display "subdirectories" of the input tiddler?

90 views
Skip to first unread message

si

unread,
Mar 1, 2021, 1:52:59 PM3/1/21
to TiddlyWiki

Hi all,

I am trying to figure out if there is a filter expression that will act on an input tiddler like "root/folder" and return all tiddlers of the form "root/folder/.*" (i.e. root/folder/subfolder1, root/folder/subfolder2 etc).

I can't figure this one out, so any help would be amazing.

My specific use case if you're interested:

I have a directory structure representing in my wiki, which I currently display with the tree macro. I was trying to see if I could use Tidgraph to display the directory structure, and I can see that I will need a filter that works as described above.

Thanks in advance for your help.

Charlie Veniot

unread,
Mar 1, 2021, 4:05:17 PM3/1/21
to TiddlyWiki
G'ay si,

Does the following do the trick?

[!is[system]regexp[root/folder]]

Charlie Veniot

unread,
Mar 1, 2021, 4:06:36 PM3/1/21
to TiddlyWiki
Well, probably a good idea to sort:

[!is[system]regexp[root/folder]sort[]]

Mat

unread,
Mar 1, 2021, 4:21:59 PM3/1/21
to TiddlyWiki
si - So you basically want what the tree macro shows but instead of the visual indentation you want it presented with paths. You can maybe try to experiment with the tree macro and see if it can display it the way you want it?

<:-)

Soren Bjornstad

unread,
Mar 1, 2021, 4:34:10 PM3/1/21
to TiddlyWiki
I think the problem si is having is that the prefix, regexp, etc. macros require the base tiddler to be inserted as a parameter, whereas the Tidgraph plugin needs a filter fragment that can take the base tiddler as an input tiddler.

I don't think I can think of a solution for this other than changing Tidgraph.

Mat

unread,
Mar 1, 2021, 4:54:49 PM3/1/21
to TiddlyWiki
Here's a simple recursion that kinda does something like it:

\define rec(tag)
<$list filter="[tag[$tag$]]" emptyMessage="<br>"><$link/>/<$macrocall $name=rec tag=<<currentTiddler>>/></$list>
\end

<<rec root>>

<:-)

si

unread,
Mar 1, 2021, 6:16:22 PM3/1/21
to TiddlyWiki
Thanks for the replies.

Soren is correct - the value "root/folder" has to be the input tiddler. I was struggling to express this well so thanks @Soren.

The filter itself does not need to create a tree. It just needs to look at the input tiddler, then return any tiddlers in the wiki of the form "<input tiddler>/blah". As Soren mentioned it doesn't look like it's actually possible.

Eskha

unread,
Mar 2, 2021, 10:01:55 AM3/2/21
to TiddlyWiki
Hello si,

Not sure if I have well understood what you wan to achieve.
Wouldn't the following call do the job?

<$list filter="[prefix<currentTiddler>sort[title]]" template="$:/core/ui/ListItemTemplate"/>

(You can change the template or use the <$list ...> ... </$list> syntax if you prefer.)

Best regards,

Eskha

si

unread,
Mar 2, 2021, 1:14:13 PM3/2/21
to TiddlyWiki
Hi Eskha thanks for the reply.

Unfortunately that's not quite what I was asking. The filter has to take the title as an input, it can't be used as a parameter. Take a look at Soren's comment as he explains it better than I can, or maybe look at the Tidgraph docs to see how it works: https://ihm4u.github.io/tw5plugs/#Custom%20Mode%20Demo.

The filter would have to look like this:

<currentTiddler>some[]filter[]expression[]

Where <currentTiddler> can't be used anywhere else in the expression.
Reply all
Reply to author
Forward
0 new messages