TIL that filter run prefixes behave interesting when used in parameters that are defined as variables.
If we start with a simple example of how things normally work:
\define outer() [first[]] [nth[3]]
<$list filter="[[HelloThere]] [[About]] [[Filters]] +[subfilter<outer>join[ - ]]" />
Each filter run in outer
receives the input to subfilter
as input, i.e. the output will be
HelloThere - Filters
This is a very useful thing, but one needs to be aware.
Now with filter run prefixes this is different:
\define inner() [addprefix[inner-]]
\define outer() [first[]] [nth[3]] :map[subfilter<inner>]
<$list filter="[[HelloThere]] [[About]] [[Filters]] +[subfilter<outer>join[ - ]]" />
This will output
inner-HelloThere - inner-Filters
So, the filter run with the :map
prefix does not receive the subfilter
input, but the output of previous filter runs in outer()
.
If this wasn’t so, we’d need a map[]
filter operator to do this kind of thing. But then again, there is no way to get :map
to work on the complete subfilter
input while keeping the results of the first two runs from outer
.
I have only tested :map
and :and
/ +
, but I believe from experience that this is implemented consistently for all filter run prefixes
I’m also not saying this is good or bad or right or wrong, but simply that one should be aware, as this is potentially very powerful and useful.
Have a nice day
Yaisog