22nd April 2024 at 8:48am
Introduction
New in v5.3.0 A function is a named snippet of text containing a Filter Expression. Functions can have named parameters which are available within the function as variables.
Functions are usually defined with the Pragma: \function:
\function myfun(param:"2")
[<param>multiply[1.5]]
\endFunctions can be called in several ways:
- Using the Calls syntax:
- Directly transclude functions with the syntax
<<myfun param:"value">> - Assign functions to widget attributes with the syntax
<div class=<<myfun param:"value">>>
- Directly transclude functions with the syntax
- Call functions via the function Operator with the syntax
[function[myfun],[value],...] - Directly call functions whose names contain a period as custom filter operators with the syntax
[my.fun[value]]or[.myfun[value]]
How Functions Work
Functions are implemented as a special kind of variable. The only thing that distinguishes them from ordinary variables is the way that the parameters are handled.