After a question about how to match tiddlers that have two tags and no 
others I realised once again that we don't have a complete set of logic 
operations available to us when using tiddlywiki filters. We don't have the 
ability to directly test a list field in a tiddler against another list. 
Tobias made a plugin a while ago that address this problem 
https://tobibeer.github.io/tw5-plugins/#contains but it used some 
non-tiddlywiki syntax and it overloaded one operator with three separate 
operations.

Since nothing has been done with this in a while I decided to make three 
filter operators to fill the gap:

contains, match and overlap

You can see the documentation for them along with examples here 
<http://ooktech.com/jed/ExampleWikis/SetFilters/#contains%20Operator:%5B%5Bcontains%20Operator%5D%5D%20%5B%5Bcontains%20Operator%20(Examples)%5D%5D%20%5B%5Bmatch%20Operator%5D%5D%20%5B%5Bmatch%20Operator%20(Examples)%5D%5D%20%5B%5Boverlap%20Operator%5D%5D%20%5B%5Boverlap%20Operator%20(Examples)%5D%5D>
.

They work a lot like the listed operator, but with the input and operand 
switched. I feel that this is much more consistent with how other filter 
operators work, although both ways have times when they are useful.

The contains operator returns a tiddler if the field given by the suffix of 
the operator (list by default) contains all of the items listed in the 
operand. It may contain more than listed in the operand.

The match operator returns a tiddler title if the field contains exactly 
the same items as the list in the operand, but they don't necessarily have 
to be in the same order.

The overlap operator returns a tiddler title if there is at least one item 
that is in both the field in the input tiddler and the operand list.

There are places where each of these can do the same thing as existing 
filters, but all of them also have unique purposes. I wanted to get some 
feedback here before I make a pull request.

I would really like to get a better name than 'overlap' for the third 
operator.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/18420261-4399-420c-984e-9ae8c861b9ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to