Template:P2/Doc
From PCSAR
(Difference between revisions)
(New page: {{template doc}} returns its second parameter.) |
|||
Line 1: | Line 1: | ||
{{template doc}} | {{template doc}} | ||
returns its second parameter. | returns its second parameter. | ||
+ | {{P1/Doc/PN}} |
Current revision
The template {{P2}}
returns its second parameter.
[edit] Pn
Related Templates | |
---|---|
P1 | Return parameter 1 |
P2 | Return parameter 2 |
P3 | Return parameter 3 |
The templates
{{Pn|param 1|param 2|param 3|...}}
,
where "n
" is a number,
each return the corresponding param n
.
They are typically used in other templates when there are several values
that can be returned, one of which is the named parameter.
Whether to use
Pn
is calculated.
E.g.
{{ {{#if: {{{1|}}} | P1 | P2 }} |{{{1}}}|{{{2|}}}}}
returns parameter 1 if it's non blank, otherwise parameter 2.
This usage might be chosen because the following more straight forward implementation would have the undesired side effect of stripping whitespace from the beginning and end of parameters 1 and 2 (a side effect of #if:).
{{#if: {{{1|}}} | {{{1}}} | {{{2|}}} }}