[forEachTiddler plugin] something acting like DoesNotContain when handling a list of tiddlers according to their tags ?

3 views
Skip to first unread message

calumet

unread,
Dec 31, 2008, 3:36:35 PM12/31/08
to TiddlyWiki
Hello,

I'm new to TiddlyWiki and using MPTW (http://mptw.tiddlyspot.com/) at
the moment, with the addition of the ForEachTiddler plugin (and a
couple of other things).

Here is an example of what I'd like to do. Let's say I want to display
a list of all the Books I have already Read that are _not_ treating of
Europe neither of Sports. Books, Read, Europe and Sports are all tags
in my TiddlyWiki.

After a short search, I tried :
forEachTiddler where 'tiddler.tags.containsAll(["Books","Read"]) &&
tiddler.tags.DoesNotContainAny(["Europe","Sports"])'

No success.

Could you help me with the right syntax and/or plugin so I get the
wished result ?

Thanks in advance.

Eric Shulman

unread,
Dec 31, 2008, 4:04:05 PM12/31/08
to TiddlyWiki
> forEachTiddler where 'tiddler.tags.containsAll(["Books","Read"]) &&
> tiddler.tags.DoesNotContainAny(["Europe","Sports"])'


The 'where' clause in the <<forEachTiddler>> macro is actually just a
javascript-based boolean conditional test that is applied to each
tiddler in the document. Thus, you can use the "!" ('not') operator
combined with the 'containsAny()' test method, like this:

<<forEachTiddler where 'tiddler.tags.containsAll(["Books","Read"]) && !
tiddler.tags.containsAny(["Europe","Sports"])' ... >>

Note: depending upon your intended use, you might find the syntax of
this plugin to be a bit easier:
http://www.TiddlyTools.com/#MatchTagsPlugin

When installed, the plugin extends the TW core's <<list filter [tag
[...]]>> feature, so you can use it like this:

<<list filter [tag[Books and Read and not (Europe or Sports)]]>>

It also adds a new <<matchTags>> macro that provides a variety of
different input modes and and ouput formatting options. For example,
the following will create a popup list of matching tiddlers:

<<matchTags popup Books and Read and not (Europe or Sports)>>

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

calumet

unread,
Jan 1, 2009, 1:19:51 PM1/1/09
to TiddlyWiki
Thanks for your fast and accurate answer, Eric.

Using the "!" ('not') operator is simple and good enough for now.
I first thought that applying a 'not' to "containsAll/Any" would give
some surprising (to me) results as I have not the typical logical
mindset of a coder but it went OK :-)

I wanted to give your MatchTagsPlugin a try as it looks quite simple
and powerful but the Import process ended with a "Error getting list
of tiddlers, click Cancel to try again" (I tried twice). Could it be
an error related to the version I use : MPTW 2.4.1 ? I may try a copy/
paste import but I don't know how many different tiddlers should I
create and the right way to tag them to make the MatchTagsPlugin work.

Happy new year!
Message has been deleted

calumet

unread,
Jan 3, 2009, 7:23:08 PM1/3/09
to TiddlyWiki
I managed to import the MatchTagsPlugin (through using the TW
+ImportExport.html from your site).

At first I was not able to use the <<list filter [tag[...]]>> with
more than a single tag (no tiddler was displayed).

Then I read the MatchTagsPluginInfo page to see the tags part had to
be put between quotes, like this :

<<list filter "[tag[Books and Read and not (Europe or Sports)]]">>

So everything works well now, thanks again!

nicolas....@gmail.com

unread,
Jan 5, 2009, 8:41:52 AM1/5/09
to Tiddl...@googlegroups.com
Hi calumet,

From your nickname and mail address I guess that you might be french or at least french-speaking.
Note that there is also a french TiddlyWiki Google group (https://groups.google.com/group/TiddlyWikiFR) if you need additional info in the future (even if the real experts are here :D)

Cheers,
Nicolas.


On Jan 4, 2009 1:23am, calumet <tressimpl...@gmail.com> wrote:
>
>
> I managed to import the MatchTagsPlugin (through using the TW
>
> +ImportExport.html from your site).
>
>
>
> At first I was not able to use the > with

>
> more than a single tag (no tiddler was displayed).
>
>
>
> Then I read the MatchTagsPluginInfo page to see the tags part had to
>
> be put between quotes, like this :
>
>
>
> >
>
>
>
Message has been deleted

calumet

unread,
Jan 5, 2009, 11:19:07 AM1/5/09
to TiddlyWiki
You are right, Nicolas.
The french TiddlyWiki Google group was already in my bookmarks as some
information there proved useful (it must be there I found out about
MPTW in the topic named "Franciser une distribution").

Merci de me l'avoir remis en mémoire en tout cas ;)

Still I consider my english fair enough to make myself clear and get
benefit of the English-speaking knowledge here :D
Reply all
Reply to author
Forward
0 new messages