Template:Eif/doc

From Wikipedia, the free encyclopedia

This template finds if an equal sign ('=') is present in the input. If it is, output is 1, else, output is 0. To use it, enter:
{{eif|test = string to test|then = optional string for output if sign present, default: 1| else = optional string for output if sign not present, default: 0}}
The equal sign in the "test = " is not detected, but any equal sign in the string is detected. Examples:

  • {{eif|test = test}} gives Template:Eif
  • {{eif|test = te=st}} gives Template:Eif
  • {{eif|test = 1=test|then = true|else = false}} gives Template:Eif
  • {{eif|test = test=|then = default|else = {{CURRENTYEAR}}}} gives Template:Eif
  • {{eif|test =}} gives Template:Eif

The code for this template is:
{{#if:{{returnInput|defaultSomething{{{test|}}}}}|{{{else|0}}}|{{{then|1}}}}} This template relies on having {{returnInput}} return the parameter 1, while the parameters defaultSomethingte or defaultSomething1 are not returned (returnInput returns only parameter 1), so nothing is returned.