30th October 2021 at 10:34pm
Literal filter parameters can be used, but such cases are better rewritten without using subfilter
:
[subfilter[one two three]addsuffix[!]]
one two three +[addsuffix[!]]
The subfilter
operator can be used to dynamically define parts of a filter run. This is useful for sharing a common pieces of a filter across multiple filters.
For example, this variable:
- recent-mods:
[has[modified]!sort[modified]limit[5]]
can be used in one filter like this:
[tag[Filter Operators]subfilter<recent-mods>addsuffix[!]]
[tag[Filter Operators]has[modified]!sort[modified]limit[5]addsuffix[!]]
and in another similar filter like this:
[tag[ActionWidgets]subfilter<recent-mods>addprefix[!]]
Variables are not the only way to define dynamic subfilters. Text references can be used to load a subfilter from a tiddler field (see also Filter Parameter):
[subfilter{$:/StoryList!!list}limit[5]]
[subfilter{$:/StoryList!!list}subfilter<recent-mods>]