Oh, I got so close… I’ve been able to figure out a lot of things (and yes, the Grok TiddlyWiki is a good read) but here I am, stuck (yet again).
I want to use a template to list spells by a complex filter.
I already have working templates like:
SpellsByTag:
<blockquote>
<$list filter="[tag[Spell]!has[draft.of]tag<search>] +[sort[title]]">
<$link/> ({{!!spellcomponents}}) [{{!!final-cost}}] {{{ [{!!notes}!is[blank]addprefix["]addsuffix["]] || Textifier }}}<br>
</$list>
</blockquote>
Which I call like this
SpellsWithFire:
<$vars search="Fire">
{{||SpellsByTag}}
</$vars>
and SpellsByLetter:
<blockquote>
<$list filter="[tag[Spell]!has[draft.of]prefix<search>] +[sort[title]]">
<$link/> ({{!!spellcomponents}}) [{{!!final-cost}}] {{{ [{!!notes}!is[blank]addprefix["]addsuffix["]] || Textifier }}}<br>
</$list>
</blockquote>
but when I try to make a template that uses a complex filter, such as
SpellsByFilter:
<blockquote>
<$list filter="[tag[Spell]!has[draft.of]] :filter<search> +[sort[title]]">
<$link/> ({{!!spellcomponents}}) [{{!!final-cost}}] {{{ [{!!notes}!is[blank]addprefix["]addsuffix["]] || Textifier }}}<br>
</$list>
</blockquote>
Calling it with:
<$vars search="[{!!final-cost}compare:integer:lteq[20]compare:integer:gt[10]]">
{{||SpellsByFilter}}
</$vars>
It doesn’t filter anything (it shows all of the spells).
I am basing this work on a tiddler that DOES work
Spells (10-20):
<blockquote>
<$list filter="[tag[Spell]!has[draft.of]] :filter[{!!final-cost}compare:integer:lteq[20]compare:integer:gt[10]] +[sort[title]]">
<$link/> [{{!!final-cost}}] {{{ [{!!notes}!is[blank]addprefix["]addsuffix["]] || Textifier }}}<br>
</$list>
</blockquote>
But, of course, to make more of these, I would have to copy the complete tiddler, and update the “:filter”. Which has become a pain, as the display format for the spells is changing over time… and I have to go to each and every one of these to update them. Hence, I thought that moving the display code into a separate template tiddler would be the answer (and it is for tags and starting letters), but I can’t get it to work for arbitrary filters.
Is it possible? I’ve tried using a macro for the filter text, instead of a var, but I haven’t been able to make that work either.
You can see the work in progress here: Spells Tiddlywiki — "Magic as Powers"