Difference between revisions of "Template:Xpd"

From MINR.ORG WIKI
m (fixed missing "}")
(mv documentation to /doc)
Line 1: Line 1:
<noinclude>{{hh}}</noinclude><includeonly>{&#123;<small>&#160;</small><code>{{{1}}}{{#if:{{{1n|}}}|</code>{&#123;<code>{{{1n}}}</code>&#125;}<code>}}{{{1a|}}}{{#ifeq:{{{4|+}}}|{{{4|-}}}|<b>&#124;</b>{{{2|}}}<b>&#124;</b>{{{3|}}}<b>&#124;</b>{{{4|}}}|{{#ifeq:{{{3|-}}}|{{{3|+}}}|<b>&#124;</b>{{{2|}}}<b>&#124;</b>{{{3|}}}|{{#ifeq:{{{2|-}}}|{{{2|+}}}|<b>&#124;</b>{{{2|}}}|}}}}}}</code>&#125;} {{{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>
+
<noinclude>{{documentation}}</noinclude><includeonly>{&#123;<small>&#160;</small><code>{{{1}}}{{#if:{{{1n|}}}|</code>{&#123;<code>{{{1n}}}</code>&#125;}<code>}}{{{1a|}}}{{#ifeq:{{{4|+}}}|{{{4|-}}}|<b>&#124;</b>{{{2|}}}<b>&#124;</b>{{{3|}}}<b>&#124;</b>{{{4|}}}|{{#ifeq:{{{3|-}}}|{{{3|+}}}|<b>&#124;</b>{{{2|}}}<b>&#124;</b>{{{3|}}}|{{#ifeq:{{{2|-}}}|{{{2|+}}}|<b>&#124;</b>{{{2|}}}|}}}}}}</code>&#125;} {{{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>
This template {{tim|evd}} shows the call of a template or predefined template and its result, for documentation.<b>&#124;</b>
 
 
 
;Usage&#58;
 
:{{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&#58;
 
#{{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=&amp;#61;}} displays
 
#:{{{{PAGENAME}}|urlencode:!|s=&#61;}}
 
#{&#123;{{PAGENAME}}|uc:abc}} gives
 
#:{{{{PAGENAME}}|uc:abc}}
 
#{&#123;subst:{{PAGENAME}}|uc:Upper Case|subst=subst:&#125;} substitutes
 
#:{&#123;<small>&#160;</small><code>subst:uc:Upper Case</code>&#125;} {{{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> &gt;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&#58;
 
:{{Tlx|{{PAGENAME}}|#ifeq: 1.00|+1|okay}} gives:
 
:{{{{PAGENAME}}|#ifeq: 1.00|+1|okay}}
 
;Example&#58;
 
:{{Tlx|{{PAGENAME}}|#ifeq: this|that<tt><nowiki>||</nowiki></tt>false|is}} gives:
 
:{{{{PAGENAME}}|#ifeq: this|that||false|is}}
 
;Example&#58;
 
:{{Tlx|{{PAGENAME}}|#expr: 3*4}} gives:
 
:{{{{PAGENAME}}|#expr: 3*4}}
 
;Example&#58;
 
:{{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>
 

Revision as of 11:41, 8 November 2007

Template documentation[create]