Basic Question
I’m pretty sure what I’m finding is a syntax error and not a fundamental logical one, but feel free to correct me if I’m wrong about that.
I’m trying to add some dynamic navigation links for a linear subset of a mostly non-linear wiki. And while I can do this with the following syntax (hardcoding “Step 2”):
<$list filter="[is[current]tags[]tag[Wizard]]">
Previous {{!!title}}: <$list filter="[before[Step 2]]"/> ::
Next {{!!title}}: <$list filter="[after[Step 2]]"/>
</$list>
Whatever I try to make this dynamic, I can’t get it to work. This is the latest broken attempt, although I’ve tried many others:
<$set name="currentStep" value="{{!!title}}">
<$list filter="[is[current]tags[]tag[Wizard]]">
Previous {{!!title}}: <$list filter="[before<currentStep>]"/> ::
Next {{!!title}}: <$list filter="[after<currentStep>]"/>
</$list>
</$set>
How do I make a working dynamic approach?
Background
In writing some documentation for a proprietary system, I’ve been happily using TW5 and loving the non-linear flow and microcontent. But I have a linear tutorial split up over a number of tiddlers, all tagged “Tutorial”, and I wanted to set up previous/next links for those, based on the Tutorial tiddler’s list
field. A simplified version is at Wizard Test — working on it.
I did see some Wizard plugins, but none seemed to do what I want, and I thought it would be a decent way to learn a little more about TW.
So my thought was that I would try to write something that I might eventually turn into a plugin, if I can get it working here. To that end, the thought was that I’d have a tag name (here “Wizard”, but eventually something more like “$:/plugins/me/wizard/Wizard”) and that if another tag – say “Tutorial” – itself was tagged with this, then everything tagged “Tutorial” would be a step of the tutorial, ordered by Tutorial’s list
field. There is some additional complexity, as I think it’s possible that one tiddler might serve as part of more than one linear paths, in which case the links will probably look like "Next Tutorial"
/"Previous Tutorial"
and "Next Foobar"
/"Previous Foobar"
Eventually, I would like to make this something automated, using a ViewTemplate. But for the moment, if it was just a macro I could include in the relevant “Tutorial”-tagged tiddlers, I would count it a win.
So the basic question is what’s wrong with my syntax?
I’m also more than open to alternative ideas for how to do this.
Secondary Question
As it stands, the links and the after
/before
operators are not using the order from the list
field, but presumably alphabetic order. Is there a straightforward way to fix this?