Difference between revisions of "Template:Ifsubst"

From Self-sufficiency
Jump to: navigation, search
Line 1: Line 1:
<noinclude><code></noinclude>{{{{{1|}}}#if:{{<includeonly>subst</includeonly>:empty template|foo}}|{{{else|}}}|{{{then|}}}}}<noinclude></code></noinclude>
+
{{{{{1|}}}#if:{{<includeonly>subst</includeonly>:empty template|foo}}|{{{else|}}}|{{{then|}}}}}<noinclude>'''When <code>subst:</code>ed, this template returns parameter <code>then</code>, else parameter <code>else</code>.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Code !! Return !! Unparsed return
 +
|-
 +
| <pre>{{ifsubst|then=foo|else=bar}}</pre> || {{ifsubst|then=foo|else=bar}} || <code><nowiki>{{ifsubst|then=foo|else=bar}}</nowiki></code>
 +
|-
 +
| <pre>{{subst:ifsubst|then=foo|else=bar}}</pre> || {{{{{1|}}}#if:|bar|foo}} || <code><nowiki>{{{{{1|}}}#if:|bar|foo}}</nowiki></code>
 +
|-
 +
| <pre>{{subst:ifsubst|then=foo|else=bar|subst:}}</pre> || foo || <code><nowiki>foo</nowiki></code>
 +
|}
 +
</noinclude>

Revision as of 18:34, 21 August 2006

When subst:ed, this template returns parameter then, else parameter else.

Code Return Unparsed return
{{ifsubst|then=foo|else=bar}}
{{ifsubst|then=foo|else=bar}}
{{subst:ifsubst|then=foo|else=bar}}
foo {{{{{1|}}}#if:|bar|foo}}
{{subst:ifsubst|then=foo|else=bar|subst:}}
foo foo