Extension:ParserFunctions process strings, strings directly or strings indirectly by way of parameters (or transclusions, or variables, or other parser functions). Parameter 1 returns the string {{{1}}} when not indicated by the user of a template, which is probably not what you want in a parser function. Rather than depending on the user to indicate the parameter is empty, apply your own default. A lone pipe symbol ("|") ensures proper handling for when parameter is or is not indicated.

We'll use #if to represent the situation of parameters in parser functions. With #if the default test string should be null, because the truth of an #if function is whether or not there is content in the test string.

How the user calls the template How the user indicates any parameters {{#if: {{{1}}}| true| false}}
{{#if: {{{param}}}| true| false}}
{{#if: {{{1|}}}| true| false}}
{{#if: {{{param|}}}| true| false}}

No indication of any parameters at all, a common situation for named parameters TRUE FALSE

{{template|}} .. {{template|1=}} .. {{template|param=}}
Parameters are indicated, but no content is given to the value FALSE FALSE

{{template|value}} .. {{template|1=value}} .. {{template|param=value}}
All indicated parameters are also given values with content TRUE TRUE

Although named parameters pass in whitespace differently from positional parameters, there is no whitespaces that counts as content in a test string. When determining whether or not informational content is intentionally passed, only the second usage ,{{{1|}}}, makes sense, because {{{1}}} becomes (interpolates to) an actual string.

When using {{{1|}}}, #if returns the same result whether the user gives no indication, {{template}}, or merely some indication: {{template|}}. Use #ifeq when you need to determine which occured.

{{#ifeq:{{{v|}}}|{{{v|-}}}| v was indicated (and may be empty) | v was not indicated }}

Furthermore a similar trick is needed and implemented in a wrapper in those rare occasions when a "sensitive" parameter cannot have a null value automatically assigned to it (when the user indicates the parameter but does not give it a value with actual content). The technique works with both named and positional (numbered) parameters.

A wrapper template uses the same set of parameters as the wrapped template with the sensitive parameter, but it handles the sensitive parameter by changing its name (to anything meaningless and inconsequential) as follows:

<!-- wrapper template code -->

The wrapped_template receives the normal_parameter and any content it containts as usual, or as explained above, with a null value if it is either not indicated at all, or merely indicated (with no content given to it).

The wrapped_template receives a sensitive_parameter only when it has content. If the sensitive parameter is in any way indicated by the user, but without giving it any content, the test string to the #if is a null character (nothing), so it reads

sensitive_parameterNULLNOTALLOWED = {{{sensitive parameter|}}}

otherwise it reads

sensitive_parameter = {{{sensitive parameter|}}}

and the content is passed through to the wrapped template.

See alsoEdit