Filter to list all tiddlers which have a word in their title, but don't have the word (or another word) in their tags

After successfully implementing MediaWiki-like categorization system in TiddlyWiki5, I am now trying to implement some infrastructure around it. In particular, I’m trying to implement MediaWiki’s page Special:UncategorizedCategories to have a report of category tiddlers, which I forgot to properly tag with parent categories.

  1. I start with "all tiddlers with titles starting with Category:"

    [prefix[Category:]]
    
  2. A variant that almost works is [prefix[Category:]!has[tags]], which I simply use in a $list widget.

  3. But some uncategorized category tiddlers might have other tags (unrelated to the categorization), which would break it. I’m trying to do something like:

    [prefix[Category:]!tag[...]]
    

    But the tag operator has no way to specify a set of operators (in this case the set is: tiddler’s tags which start with Category:)

  4. The tags operator “moves” the whole filter into the realm of tags, which one can move out of using tagging operator, but it only works for positive filters, while I need a negative filter, if it makes sense.

  5. I’m trying to understand filters in a previous discussion, which seemed like what I want, but I can’t wrap my head around the usages of all and if-then-else operators there. I’m trying to work with

    [prefix[Category:]all[current]tags[]prefix[Category:]then[...]else[...]]
    

    But I can’t figure out what to put into then and else branches and where to put the negation.

I’m not the filters expert, but I think you’re going to end up with a :map[] filter run. If @saqimtiaz is around, he’ll most probably see a way to get you moving forward.

I did notice one thing I can help with: then[] and else[] are not going to help here the way you’re thinking of them. They will each produce one result (usually a string, i.e. a single title). In other words, you can’t put “filter steps” inside them. For that you need :then[] and :else[] filter runs.

@andrybak I am not sure I have entirely understood the requirement.

This filter should show all tiddlers that are prefixed Category: themselves but do not have any tags that start with Category:

[prefix[Category:]] :filter[tags[]prefix[Category:]count[]match[0]]

If that does not meet the requirement please explain in a bit more detail the desired output of the filter.

1 Like