Template:Evd
From Eugene Neighbors
Template:Hh This template Template:Links-small shows the call of a template or predefined template and its result, for documentation.|
- Usage:
- Template:Tlx
- Template:Tlx
- The default separator is "gives", use s== or similar to get "=" etc. Please note that for parser functions the first parameter belongs to the left side before the "|" vertical bar aka pipe.
Examples without additional parameters:
Examples:
- Template:Tlx displays
- {{
CURRENTDAY{{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-|||||{{#ifeq:-|+||||{{#ifeq:-|+|||}}}}}}}} is {{#ifeq:-|+|Template:CURRENTDAY|{{#ifeq:-|+|Template:CURRENTDAY|{{#ifeq:-|+|Template:CURRENTDAY|23}}}}}}
- {{
- Template:Tlx displays
- {{
#expr:2*3{{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-|||||{{#ifeq:-|+||||{{#ifeq:-|+|||}}}}}}}} gives {{#ifeq:-|+|{{#expr:2*3|||}}|{{#ifeq:-|+|{{#expr:2*3||}}|{{#ifeq:-|+|{{#expr:2*3|}}|{{#expr:2*3}}}}}}}}
- {{
- Template:Tlx displays
- {{
#expr:2+2=5{{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-|||||{{#ifeq:-|+||||{{#ifeq:-|+|||}}}}}}}} gives {{#ifeq:-|+|{{#expr:2+2=5|||}}|{{#ifeq:-|+|{{#expr:2+2=5||}}|{{#ifeq:-|+|{{#expr:2+2=5|}}|{{#expr:2+2=5}}}}}}}}
- {{
- Template:Tlx displays
- {{
#expr:(2+2=4){{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-|||||{{#ifeq:-|+||||{{#ifeq:-|+|||}}}}}}}} = {{#ifeq:-|+|{{#expr:(2+2=4)|||}}|{{#ifeq:-|+|{{#expr:(2+2=4)||}}|{{#ifeq:-|+|{{#expr:(2+2=4)|}}|{{#expr:(2+2=4)}}}}}}}}
- {{
- Template:Tlx displays
- {{
urlencode:!{{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-|||||{{#ifeq:-|+||||{{#ifeq:-|+|||}}}}}}}} = {{#ifeq:-|+|%21|{{#ifeq:-|+|%21|{{#ifeq:-|+|%21|%21}}}}}}
- {{
- Template:Tlx gives
- {{
uc:abc{{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-|||||{{#ifeq:-|+||||{{#ifeq:-|+|||}}}}}}}} gives {{#ifeq:-|+|ABC|{{#ifeq:-|+|ABC|{{#ifeq:-|+|ABC|ABC}}}}}}
- {{
- {{subst:Evd|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:Evdn (edit•talk•links•history) 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 "}}".
- Template:Tlx gives {{
#expr:24*{{#if:CURRENTDAY|{{CURRENTDAY}}}}{{#ifeq:+|-|||||{{#ifeq:-|+||||{{#ifeq:-|+|||}}}}}}}} gives {{#ifeq:-|+|{{{{{123}}}|||}}|{{#ifeq:-|+|{{#expr:24*23||}}|{{#ifeq:-|+|{{#expr:24*23|}}|{{#expr:24*23}}}}}}}} - Template:Tlx gives Template:Evdn
- Template:Tlx gives {{
#expr:24*{{#if:CURRENTDAY|{{CURRENTDAY}}}}-24{{#ifeq:+|-|||||{{#ifeq:-|+||||{{#ifeq:-|+|||}}}}}}}} gives {{#ifeq:-|+|{{{{{123-24}}}|||}}|{{#ifeq:-|+|{{#expr:24*23-24||}}|{{#ifeq:-|+|{{#expr:24*23-24|}}|{{#expr:24*23-24}}}}}}}} - Template:Tlx gives Template:Evdn
- Template:Tlx displays
- Template:Tlx displays
Examples with additional parameters (no nesting possible):
- Example:
- Template:Tlx gives:
- {{
#ifeq: 1.00{{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-||+1|okay||{{#ifeq:okay|okay||+1|okay|{{#ifeq:+1|+1||+1|}}}}}}}} gives {{#ifeq:-|+|{{#ifeq: 1.00|+1|okay|}}|{{#ifeq:okay|okay|{{#ifeq: 1.00|+1|okay}}|{{#ifeq:+1|+1|{{#ifeq: 1.00|+1}}|{{#ifeq: 1.00}}}}}}}} - Example:
- Template:Tlx gives:
- {{
#ifeq: this{{#if:|{{{{{1n}}}}}}}{{#ifeq:false|false||that||false|{{#ifeq:|||that||{{#ifeq:that|that||that|}}}}}}}} is {{#ifeq:false|false|{{#ifeq: this|that||false}}|{{#ifeq:||{{#ifeq: this|that|}}|{{#ifeq:that|that|{{#ifeq: this|that}}|{{#ifeq: this}}}}}}}} - Example:
- Template:Tlx gives:
- {{
#expr: 3*4{{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-|||||{{#ifeq:-|+||||{{#ifeq:-|+|||}}}}}}}} gives {{#ifeq:-|+|{{#expr: 3*4|||}}|{{#ifeq:-|+|{{#expr: 3*4||}}|{{#ifeq:-|+|{{#expr: 3*4|}}|{{#expr: 3*4}}}}}}}} - Example:
- Template:Tlx gives:
- {{
#expr: 3*4}} {{#ifeq: +|-|{{{2}}}|gives}} {{#expr: 3*4}}
- {{
tc{{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-|||||{{#ifeq:-|+||||{{#ifeq:-|+|||}}}}}}}} gives {{#ifeq:-|+|in|{{#ifeq:-|+|in|{{#ifeq:-|+|in|in}}}}}} - {{
t{{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-||b|||{{#ifeq:-|+||b||{{#ifeq:b|b||b|}}}}}}}} gives {{#ifeq:-|+|start-b-end|{{#ifeq:-|+|start-b-end|{{#ifeq:b|b|start-b-end|start-pqr-end}}}}}} - {{
t{{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-||b|c||{{#ifeq:c|c||b|c|{{#ifeq:b|b||b|}}}}}}}} yields {{#ifeq:-|+|start-b-end|{{#ifeq:c|c|start-b-end|{{#ifeq:b|b|start-b-end|start-pqr-end}}}}}} - {{
t2{{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-||b|c||{{#ifeq:c|c||b|c|{{#ifeq:b|b||b|}}}}}}}} gives {{#ifeq:-|+|parameter 1 is ( b ) , parameter 2 is ( c )|{{#ifeq:c|c|parameter 1 is ( b ) , parameter 2 is ( c )|{{#ifeq:b|b|parameter 1 is ( b ) , parameter 2 is ( {{{2}}} )|parameter 1 is ( {{{1}}} ) , parameter 2 is ( {{{2}}} )}}}}}} - {{
t2{{#if:|{{{{{1n}}}}}}}{{#ifeq:d|d||b|c|d|{{#ifeq:c|c||b|c|{{#ifeq:b|b||b|}}}}}}}} gives {{#ifeq:d|d|parameter 1 is ( b ) , parameter 2 is ( c )|{{#ifeq:c|c|parameter 1 is ( b ) , parameter 2 is ( c )|{{#ifeq:b|b|parameter 1 is ( b ) , parameter 2 is ( {{{2}}} )|parameter 1 is ( {{{1}}} ) , parameter 2 is ( {{{2}}} )}}}}}} - {{
t2{{#if:|{{{{{1n}}}}}}}{{#ifeq:d|d||b|c|d|{{#ifeq:c|c||b|c|{{#ifeq:b|b||b|}}}}}}}} yields {{#ifeq:d|d|parameter 1 is ( b ) , parameter 2 is ( c )|{{#ifeq:c|c|parameter 1 is ( b ) , parameter 2 is ( c )|{{#ifeq:b|b|parameter 1 is ( b ) , parameter 2 is ( {{{2}}} )|parameter 1 is ( {{{1}}} ) , parameter 2 is ( {{{2}}} )}}}}}}
In the case of one or more named parameters, write all parameter definitions from that as value of the appropriate parameter number, e.g.:
- {{evd|t link|2=wikt=abc|3=}} gives "{{
t link{{#if:|{{{{{1n}}}}}}}{{#ifeq:+|-||wikt=abc|||{{#ifeq:|||wikt=abc||{{#ifeq:wikt=abc|wikt=abc||wikt=abc|}}}}}}}} gives {{#ifeq:-|+|Template:T link|{{#ifeq:||Template:T link|{{#ifeq:wikt=abc|wikt=abc|Template:T link|Template:T link}}}}}}"
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.
