Can you filter tiddlers based on whether they contain a transclusion?

One question. Is there a way to filter tiddlers based on whether they have transclusions or not (composite vs self-sufficient)? Is searching for ``{{ }}` the only way, or is it possible to determine if a tiddler uses a certain widget?

1 Like

I haven’t worked through this, but I guess you could use the wikify widget to get the widget tree, or the parse tree, of every tiddler, and search that for "type": "transclude". That’s a roundabout way to do it, and I imagine painfully slow to run on a large number of tiddlers. Search for { first, and get the widget tree of only tiddlers that have that? Depending on your content, there might not be many.

Sounds like a filter operator that (unless I’ve missed it) hasn’t been written yet, and maybe a question that could use its own thread?

1 Like

Even so, you might have "type": "transclude" in your tiddler content and that would mess up your results. Sounds like something to do in JS.

Edit: aha! The quotes are escaped in the widget tree though…might be ok… OK, I’m going to do something else now.

Isn’t searching for a particular widget call as easy as searching for {{ }} ?

@twMat I suppose the value of @clutterstack approach is similar to one where I render a tiddler with wikify then search the result because you are searching also for transclusions of transclusions etc…

However I think @sull-vitsy may need to spell out why he wants this, because it has different answers. For example he may just want to find out which tiddlers include some content, and finding the transclusion / content in a tiddler which is subsequently transclude elsewhere is not required.

I don’t have a need for it. I was just curious whether it was possible, especially because of the Mohammad’s discussion. Thanks for the ideas!

Also, I remember that the topic of having filter operators for transclusions has come up before.

I suppose that if you only want to know whether some sort of transclusion is present, searching for a couple of curly brackets would be OK and you wouldn’t have to do regex to make sure they’re in matching pairs etc.

Except, what if you have a tiddler with

`{{ Talking about transclusion, not doing it }}`

in it? That would show up in the search too, and in the suggested use case, the tiddler would get misclassified as composite.

I was curious too. If we were thinking about tiddlers differently based on whether they do any transclusion (etc.), we might want to be able to find them, too. All pretty theoretical for me at the moment.