Parser function extensions/zh

A "parser function" is a template-like construct that returns a value based on at least one unnamed parameter, separated from the function name by a colon [:]. There may be more parameters, as well; like those of ordinary templates, these additional parameters are each preceded by a "pipe" [|]. In the case of a hash character [#] at the start of the function name (which prevents collision with namespaces and interwiki prefixes), this may or may not be considered part of the name. If it is considered part of the name, the syntax is of the form



Arguments cannot directly contain "|" or "}}" except as part of the code of a template call, parser function call, variable, link or image, but they can contain them arbitrarily using a template, e.g.,, or a parser function.

The code can specify whether the function name is case-sensitive.

The separation of the arguments from each other is with "|", and from the function name is with the first ":" The expansion of each of these pieces is standard, as in Special:ExpandTemplates (which is a good place to experiment, by the way, if you are learning this stuff) and is beyond the control of the parser function itself.

However, everything else can be different for each parser function, including:
 * whether an argument is just a value, or of the form parname = parvalue, or whatever
 * if applicable, whether parameter names are case-sensitive

Syntax prescribed by a parser function extension
In view of the above, it is advantageous to make an extension such that the syntax to be used in an argument does not contain the pipe character "|" or double braces (more specifically, double closing braces "}}" ). This, in spite of the fact that a pipe character would otherwise seem a suitable symbol for, e.g., a choice or union (see, e.g., ). Allowing such codes is harmless if an alternative code is also allowed, e.g. "\" for "|".



函數列表


參見

 * (software development)
 * Sample parser function, from
 * Parser function extensions with documentation on Meta:
 * - requires extra table data_extension in database
 * - "Wiki Interpreter" - Complete programming language which is very similar to native parser functions.
 * Parser functions for Wikibase (the extensions that enables Wikidata): d:Wikidata:How to use data on Wikimedia projects
 * - requires extra table data_extension in database
 * - "Wiki Interpreter" - Complete programming language which is very similar to native parser functions.
 * Parser functions for Wikibase (the extensions that enables Wikidata): d:Wikidata:How to use data on Wikimedia projects
 * - "Wiki Interpreter" - Complete programming language which is very similar to native parser functions.
 * Parser functions for Wikibase (the extensions that enables Wikidata): d:Wikidata:How to use data on Wikimedia projects
 * - "Wiki Interpreter" - Complete programming language which is very similar to native parser functions.
 * Parser functions for Wikibase (the extensions that enables Wikidata): d:Wikidata:How to use data on Wikimedia projects