模板:Xpd
This 模板:Til (expansion demo) shows the call of a variable, parser function or template and its result, for documentation.
- Usage:
- {{xpd|left side|up to 3 additional parameters}}
Please note that for parser functions the first parameter belongs to the left side before "|".
Examples without additional parameters:
{{xpd|tc}} | {{tc }} ⇒ 模板:Tc
|
{{xpd|CURRENTDAY}} | {{CURRENTDAY }} ⇒ 27
|
{{xpd|#expr:2*3}} | {{#expr:2*3 }} ⇒ 6
|
{{xpd|1=#expr:2+2=5}} | {{#expr:2+2=5 }} ⇒ 0
|
{{xpd|1=#expr:2+2=4}} | {{#expr:2+2=4 }} ⇒ 1
|
{{xpd|urlencode:!}} | {{urlencode:! }} ⇒ %21
|
{{xpd|uc:abc}} | {{uc:abc }} ⇒ ABC
|
{{subst:xpd|uc:Upper Case|subst=subst:}} substitutes {{ subst:uc:Upper Case
}} gives UPPER CASE
See Help:Substitution for several caveats wrt subst=subst:.
Note that, as always, a parameter containing "=" has to be explicitly named by putting, in this case, "1=" in front.
模板:Til can be used in the case of an expression in double braces which itself includes a pair of double braces (simple nested expressions). Use "|" for the inner "{{" and, if there is code after it, also for "}}".
{{xpdn|#expr:24*|CURRENTDAY}} | 模板:Xpdn |
{{xpdn|#expr:24*|CURRENTDAY|-24}} | 模板:Xpdn |
{{xpdn|#expr:4*|#expr:not 0| >3}} | 模板:Xpdn |
{{xpdn|urlencode:|DIRMARK}} | 模板:Xpdn |
Examples with additional parameters (no nesting possible):
{{xpd|#ifeq: 1.00|+1|okay}} | {{#ifeq: 1.00|+1|okay }} ⇒ okay
|
{{xpd|#ifeq: this|that||false|s=is}} | {{#ifeq: this|that||false }} is false
|
{{xpd|t|b}} | {{t|b }} ⇒ 模板:T
|
{{xpd|t2|b|c}} | {{t2|b|c }} ⇒ 模板:T2
|
In the case of one or more named parameters, write all parameter definitions from that as value of the appropriate parameter number, e.g.:
- {{xpd|t link|2=wikt=abc|3=}} gives "{{
t link|wikt=abc|
}} ⇒ 模板:T link
"
Optional substitution with subst=subst: is not supported. The demo template shows what another template actually does, and not what it did some time ago.
Separator parameter
- Usage:
- {{xpd|left side|up to 3 additional parameters|s=separator}}
- {{xpdn|left side|nested part and optional last part|s=separator}}
- The default separator is "gives", use s== or similar to get "=" etc.
Examples with separator parameter:
{{xpd|CURRENTDAY|s=is}} | {{CURRENTDAY }} is 27
|
{{xpd|1=#expr:2+2|s==}} | {{#expr:2+2 }} = 4
|
{{xpdn|#expr:4*|#expr:not 0| >3 | yields}} | 模板:Xpdn |
See also
The above documentation is transcluded from 模板:Xpd/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |
无描述。
参数 | 描述 | 类型 | 状态 | |||
---|---|---|---|---|---|---|
没有指定参数 |