Jump to content

Wikipedia:ParserFunction precursors

From Wikipedia, the free encyclopedia
{{qif}}
{{{else{{{test|}}}|{{{test{{{test|}}}|{{{then|}}}}}}}}}
{{qif|test=A|then=X|else=Y}}
{{#if|A|X|Y}}
{{if}}
{{show1
|1={{{2|{{{then|}}}}}}
|1{{{1|{{{test|}}}}}}={{{3|{{{else|}}}}}}
}}

{{show1}}

{{{1}}}
{{if|test=A|then=X|else=Y}}
{{#if|A|X|Y}}

The following templates are meant to be included as conditions (sample use: {{qif|test={{boolxor|A|B}}|then=X|else=Y}}):

{{booleq}} (A and B are equal)
{{booleq/eq2|{{{1}}}=1|@={{{2}}}}}

{{booleq/eq2}}

{{{{{{@}}}|}}}
{{qif|test={{booleq|A|B}}|then=X|else=Y}}
{{#ifeq:A|B|X|Y}}
{{boolne}} (A and B are not equal)
{{boolnot|{{booleq|{{{1}}}|{{{2}}}}}}}
{{qif|test={{boolne|A|B}}|then=X|else=Y}}
{{#ifeq:A|B|Y|X}}
{{booland}} (A and B are not empty)
{{qif
  |test={{{1|}}}
  |then={{qif
    |test={{{2|}}}
    |then=1
    |else=
  }}
  |else=
}}
{{qif|test={{boolxor|A|B}}|then=X|else=Y}}
{{#if:{{#if:A||1}}{{#if:B||1}}|Y|X}}
{{#ifeq:{{#if:A|1}}{{#if:B|1}}|11|X|Y}}
{{boolor}} (A, B, or both are not empty)
{{qif
  |test={{{1|}}}{{{2|}}}
  |then=1
}}
{{qif|test={{boolor|A|B}}|then=X|else=Y}}
{{#if:AB|X|Y}}
{{boolnot}} (A is empty)
{{qif
  |test={{{1|}}}
  |then=
  |else=1
}}
{{qif|test={{boolnot|A}}|then=X|else=Y}}
{{#if:A|Y|X}}
{{boolxor}} (A or B is empty, but not both)
{{qif
  |test={{{1|}}}
  |then={{qif
    |test={{{2|}}}
    |then=
    |else=1
  }}
  |else={{qif
    |test={{{2|}}}
    |then=1
    |else=
  }}
}}
{{qif|test={{boolxor|A|B}}|then=X|else=Y}}
{{#ifeq:{{#if:A|1}}{{#if:B|1}}|1|X|Y}}