14,091
edits
(Some changes) |
m (clean up) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
With this template the [[Help:parser function|parser functions]] of the [[mw:Help:Extension:ParserFunctions|ParserFunctions]] collection with names starting with "#if" can be used in a way such that they do not [[m:Help: | With this template the [[Help:parser function|parser functions]] of the [[mw:Help:Extension:ParserFunctions|ParserFunctions]] collection with names starting with "#if" can be used in a way such that they do not [[m:Help:Newlines and spaces#Stripping on expansion|strip spaces and newlines]] from the "then" and "else" part. Spaces still do not affect the outcome of the condition. Parameter 1 selects the if-type as "eq", "expr", "exists" or "error" (for #iferror), or empty "||" for a simple if-there (for #if). The template can be repeatedly nested 6 or 7 levels, one inside the other, because the outer-most is completed before running either the then/else inner levels. | ||
This template can be substituted, when the expression or comparison will not change. Functionally, a lead-space character is stored, internally, as a simple blank character. Note, in many cases a null nowiki tag ("<nowiki/>") could be used, without [[Template:If]], to allow a lead-space (such as "<nowiki/> xx") anywhere, but the internal storage puts a 43-character marker for "<nowiki/>" in string length. However, there is no extra expansion depth for a nowiki-tag, such as in trailing space, "zz <nowiki/>". | This template can be substituted, when the expression or comparison will not change. Functionally, a lead-space character is stored, internally, as a simple blank character. Note, in many cases a null nowiki tag ("<nowiki/>") could be used, without [[Template:If]], to allow a lead-space (such as "<nowiki/> xx") anywhere, but the internal storage puts a 43-character marker for "<nowiki/>" in string length. However, there is no extra expansion depth for a nowiki-tag, such as in trailing space, "zz <nowiki/>". | ||
Line 39: | Line 39: | ||
==See also== | ==See also== | ||
*[[Template:Ifnotempty]] - for simplicity and to reduce the limitations due to the expansion depth limit, this is a separate template corresponding to #if only. | *[[Template:Ifnotempty]] - for simplicity and to reduce the limitations due to the expansion depth limit, this is a separate template corresponding to #if only. | ||