You’re missing the initial backslash in your \function
—I’m not sure if this was just a copy-paste error or a typo when you were testing, but I do think think it may be influencing your results. With the correct pragma, I get {{{ [[my.proc],[K],[J],[L]] }}}
= a link to “my.proc”, which is about what I would expect. It’s obviously bad syntax, but I assume the parser is treating [[my.proc]...
as a title and ignoring the rest of the filter, since there aren’t any other proper operators. But this syntax wouldn’t work with a function, either; {{{ [[my.func],[K],[J],[L]] }}}
yields a link to “my.func”.
I’m not sure I’m following your general goal and expectations, though.
- I wouldn’t expect any of your “we can’t” examples to work: procedures are functionally () far closer to macros or template transclusions (input optional variable parameters to get wikitext output). Functions are more comparable to a $let widget that defines a variable with a filtered transclusion (they yield an unformatted string of text equal to the first result of the filter).
- Procedures, like macros, aren’t meant to be filter operators, so #3 and #4 just don’t contain any valid syntax.
- Filters don’t fully wikify their input prior to parsing, so there’s no opportunity for variable substitution in #1 and #2.
my.proc
gets treated like a static variable. Honestly, I’m a little surprised that #2 works at all.
I’m just trying to figure out what you’d expect from {{{ [<my.proc 1 2 3>] }}}
, and why you’d use it over <<my.proc 1 2 3>>
, which obviously does work. Do you think it should be yielding the same output as {{{ 1 2 3 }}}
? What if <<my.proc>>
contained, say, an $edit-text
widget?
You can, if you’ve defined a function now
that takes at least one parameter, and you’ve already defined the <<date-format>>
variable. But I suspect that’s not what you meant. Do you want to use the <<now>>
macro in a filter with a variable parameter, as we can currently use it with a literal parameter like [<now YYYY0MM0DD>]
?
I’m not an expert, but it seems like this might be conflating some separate issues. <<now>>
is a Javascript macro, so it’s already somewhat distinct from procedures (= transclusions) and even “normal” wikitext macros. And we only got the ability to use [<now...>]
with a literal parameter in 5.2.0, which also suggests to me that it’s an outlier among macros (most of which don’t produce a simple string and can’t be meaningfully used in filters). So I’m not sure whether it’s a very useful example if we’re discussing the behavior of more generic macros/procedures in filters.
I may be missing something, though. I hope you can clarify!
Edit: In case anyone is trying to solve this issue for now
in particular, the format
operator lets us do this already:
<$let date-format="YYYY0MM0DD">
{{{ [<now [UTC]YYYY0MM0DD0hh0mm0ssXXX>format:date<date-format>] }}}
</$let>