Template talk:Ine

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search

See also the generalized versions Template:If equal and Template:If equal g

If the second parameter is Not Empty then do the task given by the first parameter with the second, third and fourth parameter as its parameters, else do nothing; if the number of parameters of the task is 0, 1, or 2, ignore the superfluous values (leave them empty or put a comment).

This template requires the auxiliary Template:Call, the blank Template:X0, and the template defining the task.

Examples[edit]

Using Template:tc containing "<span class="nowrap"><code>&#123;&#123;{{#if:{{{1|}}}|{{{1}}}| tlc&#124;...}}<!-- -->{{#ifeq:{{{2|x}}}|{{{2|}}}| &#124;{{{2}}} | }}<!-- -->{{#ifeq:{{{3|x}}}|{{{3|}}}| &#124;{{{3}}} | }}<!-- -->{{#ifeq:{{{4|x}}}|{{{4|}}}| &#124;{{{4}}} | }}<!-- -->{{#ifeq:{{{5|x}}}|{{{5|}}}| &#124;{{{5}}} | }}<!-- -->{{#ifeq:{{{6|x}}}|{{{6|}}}| &#124;{{{6}}} | }}<!-- -->{{#ifeq:{{{7|x}}}|{{{7|}}}| &#124;{{{7}}} | }}<!-- -->{{#ifeq:{{{8|x}}}|{{{8|}}}| &#124;{{{8}}} | }}<!-- -->{{#ifeq:{{{9|x}}}|{{{9|}}}| &#124;{{{9}}} | }}<!-- -->&#125;&#125;</code></span><noinclude>{{doc}}</noinclude>":

  • {{ine|tc|comment||}} gives "{{comment||}}"
  • {{ine|tc||comment|}} gives ""

Using Template:t containing "<includeonly><!--t-->start-{{{1|pqr}}}-end</includeonly><noinclude><nowiki>start-{{{1|pqr}}}-end</nowiki> == Examples == {| class = "wikitable" ! Code ! Result |- style="vertical-align:top;" | <pre> {{T}} </pre> ||{{T}} |- style="vertical-align:top;" | <pre> {{T|}} </pre> ||{{T|}} |- style="vertical-align:top;" | <pre> {{T|abc}} </pre> ||{{T|abc}} |- style="vertical-align:top;" | <pre> {{T|abc|def}} </pre> ||{{T|abc|def}} |- style="vertical-align:top;" | <pre> {{T|1=abc|1=def}} </pre> ||{{T|1=abc|1=def}} |- style="vertical-align:top;" | <pre> {{T|abc|1=def}} </pre> ||{{T|abc|1=def}} |- style="vertical-align:top;" | <pre> {{T|1=abc|def}} </pre> ||{{T|1=abc|def}} |- style="vertical-align:top;" | <pre> {{T|{{T}}}} </pre> ||{{T|{{T}}}} |- style="vertical-align:top;" | <pre> {{T|{{T|{{T}}}}}} </pre> ||{{T|{{T|{{T}}}}}} |- style="vertical-align:top;" | <pre> {{T|{{T|{{T|{{T}}}}}}}} </pre> ||{{T|{{T|{{T|{{T}}}}}}}} |- style="vertical-align:top;" | <pre> {{T|a{{T|b}}}} </pre> ||{{T|a{{t|b}}}} |- style="vertical-align:top;" | <pre> {{T|{{T|a<nowiki>=</nowiki>b}}}} </pre> ||{{T|{{T|a=b}}}} |- style="vertical-align:top;" | <pre> {{T|<nowiki>a=b</nowiki>}} </pre> ||{{T|a=b}} |- style="vertical-align:top;" | <pre> {{T|1<nowiki>=a=b</nowiki>}} </pre> ||{{T|1=a=b}} |} <!-- customize to illustrate parameter use; remove space in subst to activate it; {{sub st:nwrt|{{T|}}}} {{sub st:nwrt|{{T|}}}} {{sub st:nwrt|{{T|}}}} {{sub st:nwrt|{{T|}}}} {{sub st:nwrt|{{T|}}}} {{sub st:nwrt|{{T|}}}} {{sub st:nwrt|{{T|}}}} {{sub st:nwrt|{{T|}}}} {{sub st:nwrt|{{T|}}}} {{sub st:nwrt|{{T|}}}} --> [[Category:Demo template]]</noinclude>":

  • {{ine|t|abc|comment|}} gives "start-abc-end"
  • {{ine|t||comment|}} gives ""

Using Template:Death containing "Date of death: {{{1}}}, place of death: {{{2}}}":

  • {{ine|death|[[November 2]], [[2004]]|[[Amsterdam]]|}} gives:

"Date of death: November 2, 2004, place of death: Amsterdam".

  • {{ine|death||comment|}} gives "".

This can be useful inside another template, to avoid the texts "Date of death:" and "place of death:" for a living person.


Using Template:p2p1p3 containing "{{{2}}}{{{1}}}{{{3}}}"

  • {{ine|p2p1p3|a|b|c}} gives:

"bac"

  • {{ine|p2p1p3||d|e}} gives:

""

Applied for death info:

  • {{ine|p2p1p3|[[November 2]], [[2004]]|Date of death:  |, place of death: [[Amsterdam]]}} gives:

"Date of death: November 2, 2004, place of death: Amsterdam".

This would not be convenient to use in many template tags, but could be used in an infobox in the form

  • {{ine|p2p1p3|{{{1}}}|Date of death:  |, place of death: {{{2}}}}}

See also[edit]