Module:Xpd/doc

This module is invoked from Template:Xpds, Template:Xpdp, Template:Xpdws and Template:Xpdwp (w = show wikitext produced, s = same line, p = new paragraph), expansion demo templates that show the call of a variable, parser function or template, optionally its resulting wikitext, and the latter's rendering. It is also invoked from Template:Xpdplains and Template:Xpdplainp, templates that show plain wikitext and its rendering. They are used for testing and documenting variables, parser functions, templates, and wikitext and html features. The technical notes below apply partly to all templates, partly to the first four only.

For parameters with explicit positive integer names the integer is reduced by 1 in the result (just like for implicit names, due to the position taken by the template name in the calls of the templates xpds and xpdp).

Expressions for parameter values are replaced by their results.

Without affecting the result the template call is written in a normalized form:
 * Values of named parameters are trimmed.
 * Definitions of parameters with implicit or explicit positive integer names are ordered in ascending order. Explicit names among them are removed. These parameters are put before the remaining ones. Multiple definitions of the same parameter are replaced by the final one.
 * In the parameter names and values (after the expansion mentioned above) any braces, pipes and/or equal signs are changed into,  ,  , and  , so that the parsing of the call is kept intact.

Examples:

gives:

Wikitext on the left
To display on the left-hand side the wikitext and not the rendering of the parameter values, some adjustments are made at that side :
 * is replaced by
 * square brackets are replaced by  and
 * newlines are replaced by
 * spaces are replaced by

Examples:

Limitation
Parameters with explicit or implicit positive integer names have to form a set {1, 2, .. k} without gaps. A template call with for example an undefined parameter 1 and a defined parameter 2 is not supported (where an undefined parameter should not be confused with a parameter which is assigned as value the empty string, these are supported) :

gives: