There is a current tiddler set, either in the story or in a list widget without a variable set. In contrast, as you may recall in tabs, the currentTab is set, not the currentTiddler.
When you use a filter you may generate a list of titles, and if you use one of the filter runs like :filter and :map within them you have the …currentTiddler and currentTiddler variables, sure, but that is a feature of the filter runs.
Otherwise in a filter of any kind you can choose to use [all[current]
or [<currentTiddler>]
to access the current story tiddler, or that within an “outer list”.
However, if you are instead using a filter like [tag[TableOfContents]...
the titles will change once for each tiddler so tagged. If you then feed this to a function eg [addprefix[$:/meta/]]
the function treats each input as a separate title, and adds the prefix to each.
\function add.it() [addprefix[$:/meta/]]
<$list filter="[tag[TableOfContents]add.it[]]">
</$list>
If currentTiddler was not changed, this remains available. So lets make use of the currentTiddler from the story in the following;
In the demo tiddler;
\function add.it() [addprefix[$:/meta/]addsuffix[/]addsuffix<currentTiddler>]
<$list filter="[tag[TableOfContents]add.it[]]">
</$list>
The result is each TableOfContents tiddler, with the $:/meta/
prefix and /
and currentTiddler Suffix.
- See current tiddler is still an independent variable
- Unlike in the filter runs, the currentTiddler variable does not get set to the “current title”. Thats why I don’t want to reuse it.
- Observe how the function/filter “add.it”, starts without a named title,
[all[current]
etc, it just starts and acts on each title given to it.
Extended notes
- Now with our new
function.title
these filters (in a function return the same thing)
-
[addprefix[$:/meta/]]
and [function.title[]addprefix[$:/meta/]]
- After processing each title it then adds the suffix of currentTiddler, which is the story tiddler. The list widget then lists the titles from the filter (using its currentTiddler variable).
This will not work, using the function.title
as a variable. [<function.title>addprefix[$:/meta/]]
- It will only return the first result.