So I have a procedure that requires an argument that is a variable (e.g <<currentTiddler>>) when called. I want to use the procedures output in a filter. How do I do this syntactically, i.e how do I get the argument into the procedure in the following?
The best approach will depend on the contents of your procedure, but if it’s only intended to store a single variable or output a simple string of text, this is a perfect scenario for a function instead.
\function one(myvariable) [<myvariable>]
Call it like this: {{{ [function[one],<currentTiddler>match[bar]then[foobar]] }}}
The first argument of function is the name of the function to use; each additional argument defines a parameter of that function, assigned in the order that you defined them in the function. Each parameter (including the name of the function itself!) can be [text], a <variable>, or a {!!transclusion}.
Or if you use at least one . in the function name, you can use it as an ad-hoc filter operator.
\function .one(myvariable) [<myvariable>]
Call it like this: {{{ [.one<currentTiddler>match[bar]then[foobar]] }}}
Or like this: {{{ [function[.one],<currentTiddler>match[bar]then[foobar]] }}}
If your procedure is anything more complicated than a variable or a filter… I’m afraid you’re going to have to $wikify it as a separate step before you use it in a filter, sorry.
@etardiff - I appreciate your kind reply but, alas, it is indeed more complicated than a variable or filter. And I dont get the wikifywidget to work for it either. I might post the full thing in a bit. Again, thank you.
There is very little a filter, thus a function can’t do including variables, it also has the advantage that it need not be wikified nor does it require the text widget.
I can give more assistance if you want to take this approach, which I recommend. (
This includes using +[join[ ]] or +[format:titlelist[]join[ ]] to allow more than the first value be returned.