• Home
  • Random
  • Log in
  • Settings
  • About Seeds of the Word
  • Disclaimers
Seeds of the Word

Template:Ifnotempty

  • Language
  • Watch
  • View source


Template documentation

With this template #if can be used in a way such that it does not strip spaces and newlines from the "then" and "else" part. For evaluating the condition spaces and newlines are stripped like with ParserFunctions.

This template can be substituted.

Usage

  • {{ifnotempty| x | A | B }} gives "Template:P1"
  • {{ifnotempty|x| A | B }} gives "Template:P1"
  • {{ifnotempty| | A | B }} gives " B "
  • {{ifnotempty|| A | B }} gives " B "

Compare:

  • {{#if:x| A | B }} gives "A"
  • {{#if:| A | B }} gives "B"

Internal technical details

For evaluating the condition (determining non-emptiness of the first parameter) the template uses parser function #if, producing 1 if the condition is true, and 2 otherwise. The template with name equal to "P" followed by the index value produced (hence Template:P1 or Template:P2), is called with as parameters A and B. This produces either A or B, without trimming.

See also

  • Template:If
  • m:Template:Ifnotempty
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Subpages of this template.
Retrieved from "https://en.seminaverbi.bibleget.io/w/index.php?title=Template:Ifnotempty&oldid=1594"
Last edited 5 years ago by Johnrdorazio

Languages

      This page is not available in other languages.

      Seeds of the Word
      • This page was last edited on August 21, 2020, at 19:50.
      • Content is available under Creative Commons Attribution unless otherwise noted.
      • Privacy policy
      • About Seeds of the Word
      • Disclaimers
      • Terms of Use
      • Desktop
      • Developers
      • Statistics
      • Cookie statement