I've done some extending of the IncludePlugin [0] which enabled it to
include not all but some tiddlers from another document (currently the
five "filters" mentioned in [1] are implemented). However, before I or
Udo will publish it, I think it's important to substitute the "hand-
made filters" by TW core filters. But for this I need better
understanding of filters, what is implemented and how difficult would
it be to do further extensions.
First, let's consider the core filters. As I understand, there are 4
of them:
* field filter ([fieldName[fieldValue]]) *adds* tiddlers which have
fieldName value equal to the fieldValue
** can this work with custom fields? which syntax should be used and
does it work for, say "sort" field?
* tiddler adder ([[tiddlerName]]) *adds* a tiddler to the list
* sorter ([sort[?fieldName]], "?" can be nothing, "-" or "+") - sorts
the *already added* tiddlers in the list by the field value (ascending
or descending, one of them by default)
* list limiter ([limit[listLength]]) cuts all but listLength items
from the *already added* tiddlers
Did I miss any core filter (aside the separate tag filter) or rather
it's behavoir? Is it correct that there's no core way to *remove* some
tiddlers from the list (like those having some tag)?
Why the tag filter is separate from other field filters? (this is also
connected with the next question)
Eric, is it correct that MatchTagsPlugin [2] adds the boolean logic
only to the tag filter? Does it actualy hijack the tag filter or it
does smth else (there's some tricky code in the end of the plugin)?
This is important because I don't understand: if I use the filter
mechanism in the IncludePlugin, will the MatchTagsPlugin "do the
boolean job", or I'll have to impement this once again? Aside: can the
new syntax be used in DefaultTiddler?
What is the match[1], match[2], .. in the filters' code [3]? I
understand the idea of the code, but I don't understand how to write
another filter (for instance, which will cut the tiddlers with some
tag).
----
A couple of side questions since I revise the notes on filters anyway:
* Where, aside the <<list>> and DefaultTiddlers, core filters can be
used? Some examples of plugins which use the core filters?
* Can the template mechanism of the list macro be used for creating a
list of sliders which open tiddlers' content?
[0] http://tiddlywiki.abego-software.de/#IncludePlugin
[1] http://groups.google.com/group/tiddlywikidev/browse_thread/thread/49136bc96a87aeef
, post 7
[2] http://www.TiddlyTools.com/#MatchTagsPlugin
[3] https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Filters.js
There is currently no core way to remove filters or do ANDs but I
believe you are right and that Eric's plugin does do that.
However it is possible for a plugin to EXTEND the filters to be more
than limit, sort, <field or attribute>
You may also be interested in the filters TiddlySpace which extends
the filter syntax using this mechanism - http://filters.tiddlyspace.com/#SiteInfo
- there is lots of code here you could look at to understand the
filter code's extension mechanism.
This resource may also be useful:
http://docs.tiddlyspace.com/filters%20syntax
hope some of this helps!
Jon
> [1]http://groups.google.com/group/tiddlywikidev/browse_thread/thread/491...
[tag[SomeTag]]
match[3] == "SomeTag"
However, I don't understand the general destination of the "match"
array, and some core filters use also match[1], match[4] (like this
[1]). It seems that the clue is in the [2] part of the Filters.js, but
I quite understand it.
Anyway, I'll ask some more questions when I implement the extension of
the IncludePlugin and when new filters are needed.
[1] https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Filters.js#L8
[2] https://github.com/TiddlyWiki/tiddlywiki/blob/master/js/Filters.js#L53