|
|
(12 intermediate revisions by 7 users not shown) |
Line 1: |
Line 1: |
− | <noinclude>{{hh}}</noinclude><includeonly>{{<small> </small><code>{{{1}}}{{#if:{{{1n|}}}|</code>{{<code>{{{1n}}}</code>}}<code>}}{{{1a|}}}{{#ifeq:{{{4|+}}}|{{{4|-}}}|<b>|</b>{{{2|}}}<b>|</b>{{{3|}}}<b>|</b>{{{4|}}}|{{#ifeq:{{{3|-}}}|{{{3|+}}}|<b>|</b>{{{2|}}}<b>|</b>{{{3|}}}|{{#ifeq:{{{2|-}}}|{{{2|+}}}|<b>|</b>{{{2|}}}|}}}}}}</code>}} {{{s|gives}}} {{#ifeq:{{{4|-}}}|{{{4|+}}}|{{{{{1{{{{{1n|void}}}}}{{{1a|}}}}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}}}|{{#ifeq:{{{3|-}}}|{{{3|+}}}|{{{{{1}}}{{{{{1n|void}}}}}{{{1a|}}}|{{{2|}}}|{{{3|}}}}}|{{#ifeq:{{{2|-}}}|{{{2|+}}}|{{{{{1}}}{{{{{1n|void}}}}}{{{1a|}}}|{{{2|}}}}}|{{{{{1}}}{{{{{1n|void}}}}}{{{1a|}}}}}}}}}}}</includeonly><noinclude>
| + | {{{{{substnp|}}}if|subst={{{substnp|}}}|eq|{{{4|+}}}|{{{4|-}}}|{{xpd3|d={{{d|}}}|gives={{{gives|gives}}}|l={{{l|}}}|{{{1}}}|{{{2|}}}|{{{3|}}}|{{{4}}}}}|{{{{{substnp|}}}if|subst={{{substnp|}}}|eq|{{{3|-}}}|{{{3|+}}}|{{xpd2|d={{{d|}}}|gives={{{gives|gives}}}|l={{{l|}}}|{{{1}}}|{{{2|}}}|{{{3}}}}}|{{{{{substnp|}}}if|subst={{{substnp|}}}|eq|{{{2|-}}}|{{{2|+}}}|{{xpd1|d={{{d|}}}|gives={{{gives|gives}}}|l={{{l|}}}|{{{1|}}}|{{{2|}}}}}|{{xpd0|d={{{d|}}}|gives={{{gives|gives}}}|l={{{l|}}}|{{{1}}}}}}}}}}}<noinclude>{{documentation}}</noinclude> |
− | This template {{tim|evd}} shows the call of a template or predefined template and its result, for documentation.<b>|</b>
| |
− | | |
− | ;Usage:
| |
− | :{{Tlx|{{PAGENAME}}|left side|</tt>up to 3 additional parameters}}
| |
− | :{{Tlx|{{PAGENAME}}|left side|</tt>up to 3 additional parameters|4=s=separator}}
| |
− | | |
− | :The default separator is "'''gives'''", use <tt>s==</tt> or similar to get "'''='''" etc. Please note that for [[Help:colon function|colon function]]s the first parameter belongs to the left side before the "'''|'''" vertical bar aka ''pipe''.
| |
− | | |
− | Examples without additional parameters:
| |
− | | |
− | Examples:
| |
− | #{{Tlx|{{PAGENAME}}|CURRENTDAY|3=s=is}} displays
| |
− | #:{{{{PAGENAME}}|CURRENTDAY|s=is}}
| |
− | #{{Tlx|{{PAGENAME}}|#expr:2*3}} displays
| |
− | #:{{{{PAGENAME}}|#expr:2*3}}
| |
− | #{{Tlx|{{PAGENAME}}|<nowiki>1=#expr:2+2=5</nowiki>}} displays
| |
− | #:{{{{PAGENAME}}|1=#expr:2+2=5}}
| |
− | #{{Tlx|{{PAGENAME}}|<nowiki>1=#expr:(2+2=4)</nowiki>|<nowiki>s==</nowiki>}} displays
| |
− | #:{{{{PAGENAME}}|1=#expr:(2+2=4)|s==}}
| |
− | #{{Tlx|{{PAGENAME}}|urlencode:!|3=s=&#61;}} displays
| |
− | #:{{{{PAGENAME}}|urlencode:!|s==}}
| |
− | #{{{{PAGENAME}}|uc:abc} gives
| |
− | #:{{{{PAGENAME}}|uc:abc}}
| |
− | #{{subst:{{PAGENAME}}|uc:Upper Case|subst=subst:}} substitutes
| |
− | #:{{<small> </small><code>subst:uc:Upper Case</code>}} {{{2|gives}}} UPPER CASE
| |
− | #:See [[m:Help:Substitution|Help:Substitution]] for several caveats wrt <tt>subst=subst:</tt>.
| |
− | | |
− | 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 {{Lts|evdn}} 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 ('''N'''ested part of first parameter) and optionally 1a (part '''A'''fter that). For the latter, use "|" for the inner "<nowiki>{{</nowiki>" and, if there is code after it, also for "}}".
| |
− | | |
− | #{{Tlx|evd|#expr:24*|3=1n=CURRENTDAY}} gives {{evd|#expr:24*|1n=CURRENTDAY}}
| |
− | #{{Tlx|evdn|#expr:24*|CURRENTDAY}} gives {{evdn|#expr:24*|CURRENTDAY}}
| |
− | #{{Tlx|evd|#expr:24*|3=1n=CURRENTDAY|4=1a=-24}} gives {{evd|#expr:24*|1n=CURRENTDAY|1a=-24}}
| |
− | #{{Tlx|evdn|#expr:24*|CURRENTDAY|-24}} gives {{evdn|#expr:24*|CURRENTDAY|-24}}
| |
− | #{{Tlx|evdn|#expr:4*|#expr:not 0|<nowiki> >3 | yields</nowiki>}} displays
| |
− | #:{{evdn|#expr: 4*|#expr:not 0| >3 | yields}}
| |
− | #{{Tlx|evdn|urlencode:|DIRMARK}} displays
| |
− | #:{{evdn|urlencode:|DIRMARK}}
| |
− | | |
− | Examples with additional parameters (no nesting possible):
| |
− | | |
− | ;Example:
| |
− | :{{Tlx|{{PAGENAME}}|#ifeq: 1.00|+1|okay}} gives:
| |
− | :{{{{PAGENAME}}|#ifeq: 1.00|+1|okay}}
| |
− | ;Example:
| |
− | :{{Tlx|{{PAGENAME}}|#ifeq: this|that<tt><nowiki>||</nowiki></tt>false|is}} gives:
| |
− | :{{{{PAGENAME}}|#ifeq: this|that||false|is}}
| |
− | ;Example:
| |
− | :{{Tlx|{{PAGENAME}}|#expr: 3*4}} gives:
| |
− | :{{{{PAGENAME}}|#expr: 3*4}}
| |
− | ;Example:
| |
− | :{{Tlx|evaldemo|#expr: 3*4}} gives:
| |
− | :{{evaldemo|#expr: 3*4}}
| |
− | | |
− | :{{{{PAGENAME}}|tc}}
| |
− | :{{{{PAGENAME}}|t|b}}
| |
− | :{{{{PAGENAME}}|t|b|c|s=yields}}
| |
− | :{{{{PAGENAME}}|t2|b|c}}
| |
− | :{{{{PAGENAME}}|t2|b|c|d}}
| |
− | :{{{{PAGENAME}}|t2|b|c|d|s=yields}}
| |
− | | |
− | Optional substitution with <tt>subst=subst:</tt> 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.
| |
− | | |
− | [[Category:Handbook templates|{{PAGENAME}}]]
| |
− | </noinclude> | |