Template:Error if empty/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by imported>Gonnym at 18:42, 19 December 2025 (-deleted). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The templates {{Error if empty}} is used to avoid unwanted transclusions of the {{Error}} template in the cases in which the {{#if}} (or a similar) parser function is not directly used for determining the error conditions. In these cases, these templates will appear permanently transcluded instead of {{Error}}.

Usage

This template checks whether the first parameter is empty. If it is, it redirects all other parameters, shifted, to {{Error}}; otherwise it shows the first parameter, trimmed of trailing and leading spaces.

  • {{Error if empty|Hello world|Error: Lorem ipsum dolor sit amet.}}
    ↳ Hello world
  • {{Error if empty||Error: Lorem ipsum dolor sit amet.}}
    Error: Lorem ipsum dolor sit amet.
  • {{Error if empty|}}
    Error: There is no text to show.
  • {{Error if empty}}
    Error: There is no text to show.

See also