Template:Ifne/doc

From Ring of Brodgar
Jump to navigation Jump to search
Right ... Merge this template with the already existing Ufne Template. (Use First Non Empty)
ifne (IF Not Empty)
  • General template to return the first non-empty (numbered) parameter'.
  • Generally intended for use with more than 2 parameters.
  • Current max:5 (See: notes)
  • Returns empty string if all inputs are empty. (See: Optional)


General use.
{{ifne|<parm1>|<parm2>|...}}
Example: {{ifne| {{{p1}}} | {{{p2}}} |{{{p3}}} }}
Note that if there is a change the used parameters might not be SET. Do use the additional "|" after the parameter name.
Like: {{ifne| {{{p1|}}} | {{{p2|}}} |{{{p3|}}} }}
This is the general fail-save way to use it.


Optional.
  • "EE=" flag which will trigger error on empty-string return.
{{ifne|EE=|<parm1>|...}} -- Position of "EE=" don't matters.


Additional notes.
  • All leading and trailing spaces around parameter content are always ditched by used MW-process.
  • Max exceeded error: Only return this error if fist data is found after parm-5. Checks up to parm-9.
  • ...


Background.
When using {{{p1| {{{p2| {{{p3|}}} }}} }}} it will check if p1 and p2 are NOT SET. But this will not work with SET but still EMPTY parameters.
Only {{#if:<if not set OR empty>{{{p1|}}}|<than>{{{p1}}}|<else>...}} will do empty parameter checking.
This template will take care of that, removing the need to have the related bulk-code inside other templates.