Template:Hh This template Template:Tim shows the call of a template or predefined template and its result, for documentation.|
- Usage:
{{Xpd|left side|up to 3 additional parameters}}
{{Xpd|left side|up to 3 additional parameters|s=separator}}
- The default separator is "gives", use s== or similar to get "=" etc. Please note that for colon functions the first parameter belongs to the left side before the "|" vertical bar aka pipe.
Examples without additional parameters:
Examples:
{{Xpd|CURRENTDAY|s=is}}
displays- {{
CURRENTDAY
}} is "22"
- {{
{{Xpd|#expr:2*3}}
displays- {{
#expr:2*3
}} gives "6"
- {{
{{Xpd|1=#expr:2+2=5}}
displays- {{
#expr:2+2=5
}} gives "0"
- {{
{{Xpd|1=#expr:(2+2=4)|s==}}
displays- {{
#expr:(2+2=4)
}} = "1"
- {{
{{Xpd|urlencode:!|s==}}
displays- {{
urlencode:!
}} = "%21"
- {{
- {{Xpd|uc:abc} gives
- {{
uc:abc
}} gives "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:.
- {{
As always the expression (first parameter) cannot directly contain "|", "=", plus other special cases related to square brackets / curly braces. In the case of this template "not directly" means "never" except from "=" as shown above.
This template and Template:Lts can be used if the case of an expression in double braces which itself includes a pair of double braces (simple nested expressions). For the former, use named parameters 1n (Nested part of first parameter) and optionally 1a (part After that). For the latter, use "|" for the inner "{{" and, if there is code after it, also for "}}".
{{evd|#expr:24*|1n=CURRENTDAY}}
gives Template:Evd{{evdn|#expr:24*|CURRENTDAY}}
gives Template:Evdn{{evd|#expr:24*|1n=CURRENTDAY|1a=-24}}
gives Template:Evd{{evdn|#expr:24*|CURRENTDAY|-24}}
gives Template:Evdn{{evdn|#expr:4*|#expr:not 0| >3 | yields}}
displays{{evdn|urlencode:|DIRMARK}}
displays
Examples with additional parameters (no nesting possible):
- Example:
{{Xpd|#ifeq: 1.00|+1|okay}}
gives:- {{
#ifeq: 1.00|+1|okay
}} gives "okay" - Example:
{{Xpd|#ifeq: this|that||false|is}}
gives:- {{
#ifeq: this|that||false
}} gives "false" - Example:
{{Xpd|#expr: 3*4}}
gives:- {{
#expr: 3*4
}} gives "12" - Example:
{{evaldemo|#expr: 3*4}}
gives:- Template:Evaldemo
- {{
tc
}} gives "{{tlc|...}}
" - {{
t|b
}} gives "{{b}}" - {{
t|b|c
}} yields "{{b}}" - {{
t2|b|c
}} gives "Template:T2" - {{
t2|b|c|d
}} gives "Template:T2" - {{
t2|b|c|d
}} yields "Template:T2"
Optional substitution with subst=subst: is not supported. It's anyway against the spirit of this demo template showing what another template actually does, and not what it did some time ago.