Template:Ifnotempty/doc

From Lotro-Wiki.com
Jump to navigation Jump to search
This is the template documentation for {{Ifnotempty}}. It is transcluded from Template:Ifnotempty/doc and may be directly edited there.

Purpose

This template can be used to preserve whitespace (spaces, newlines) surrounding parameters in an if..then..else statement within a template. It is most useful for creating conditional rows or columns in tables within a template, since tables require newlines to be preserved for proper formatting.

Syntax

{{ifnotempty| expression | part if expression not empty | part if expression empty }}

Usage

  • {{ifnotempty|x| p | q }} gives " p "
  • {{ifnotempty|| p | q }} gives " q "

Note that, unlike parser functions, templates require writing equals signs in values of unnamed parameters as {{=}}

Example

For a real-world example of how to use this template, see Template:Barterer.

For More Information

See [1]