The short answer is that you can probably do this using the contains plugin 
by Tobias https://tobibeer.github.io/tw5-plugins/#contains and ignore 
everything I say below. The long answer is below and as much for a later 
discussion as anything else.

Sorry about the long a overly detailed response, this is an area that I am 
very interested in and you gave me a good example to work with. So thank 
you!

I have been trying to track down which logic statements you can't express 
using filters and I believe that you have found one. From what I can 
determine right now the only way to do this currently is to use an 
intermediate step where you would have to save a list to a field and then 
use that list to get your final result, which means you would have to click 
a button at least once to update the list.

I made a wiki with some explanation of how logic statements correspond to 
filters, it may be useful: 
http://ooktech.com/jed/ExampleWikis/FilterLogicExamples/

I have a working version that makes you click a button to update the list 
correctly, but it is mostly for my notes so that I can make a filter that 
lets you do this because this version is kind of awkward.

To do this with any number of tags you need to fulfil two criteria: 
* You need the set TagA and TagB to be a subset of the tags of the tiddler 
* You also need the union of the set of all tags minus TagA and TagB with 
the tags of your filter to the the empty set.

You can put this demo code into a tiddler on tiddlywiki.com, after clicking 
the button 
<!-- Get the set of all tags minus (TagA, TagB), store it in a field -->
<$button>
<$action-setfield $tiddler='$:/temp/IntermediateList' list=''/>
Get Excluded Tiddlers
<!-- The first filter builds the set of excluded tags -->
<$list filter='[all[]tags[]] -[[ActionWidgets]] -[[Widgets]]' 
variable=ExcludedTag>
<!-- The second list returns all tiddlers that have tags that we need to 
exclude from our result -->
<$list filter='[tag<ExcludedTag>]'>
<$action-listops $tiddler='$:/temp/IntermediateList' $field='list' 
$subfilter='+[append<currentTiddler>]'/>
</$list>
</$list>
</$button>
<!-- Now take the set of all tiddlers with the TagA and TagB and subtract 
the excluded tiddlers list -->

! Excluding Other Tags

<$list 
filter='[tag[ActionWidgets]tag[Widgets]]-[list[$:/temp/IntermediateList]]'>


</$list>

! Without Excluding Other Tags

<$list filter='[tag[ActionWidgets]tag[Widgets]]'>

</$list>

Is looks like one thing we are missing from what filters can do is checking 
if a set contains an element. We can check if A is contained in set B (that 
is what tag[foo] or field:foo[bar] does), but we can't check if set B 
contains A. Tobias may have worked on a filter to do this a while ago. If 
we had that filter than we could replace the above code with something like 
this:

<$set name=ExcludedTags filter='[all[]tags[]]-TagA-TagB'>
<$list filter='[tag[TagA]tag[TagB]!contains:tags<ExcludedTags>]'>

</$list>
</$set>

the contains operator would return the input title if the set intersection 
between the field of the input tiddler and the parameter (which could be a 
list or a single item) is anything other than the empty set. The negated 
operator (!contains) would return the input title if the intersection is 
the empty set.

-- 
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/1c879ddf-4b9f-4008-8538-c8e37172e8bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to