Help:Parser functions

A "parser function" is a template-like construct which returns a value based on at least one unnamed parameter, separated from the function name by a colon ":"; there may be more parameters which, like those of ordinary templates, are each preceded by "|".

Parser functions allow you to use a little bit of programming logic in your templates, including "if" statements and basic calculations.

There are many simple ones that are built into MediaWiki itself. Some extensions also add a few for specific tasks. There is a large collection of commonly used ones by the name of ParserFunctions which Wikia has enabled by default on all wikis. Another example of an extension adding parser functions is StringFunctions, which adds string manipulation functions.

Parser functions in action
You can hide table rows which contain empty parameters by using a variation of:

Produces the following code only if input is defined.


 * input
 * input

| is used in the above parser function instead of | as the extension uses | to separate parameters. | is a template at Template:! which transcludes | into the code after the parser function has been validated.