Template:If then show/doc

This template tests whether the first unnamed parameter is not an empty string and returns it if it is not empty. Otherwise it returns the second unnamed parameter.

This is useful when the first parameter is a of a Lua module that may return a value or nothing. Because it uses the just once, it simplifies the coding of infoboxes, for example.

The optional third and fourth unnamed parameters provide a prefix and a suffix for the first parameter when returned. This enables the designer to construct more complex templates that still only use one invoke of a Lua module.

Usage

 * for


 * for

Infobox field with microformat
A value in an infobox can be designed to be wrapped in a microformat if the wikidata call is not empty:
 * If there is a local parameter supplied in the article (e.g. London), the code will return.
 * If there is no local parameter it will attempt to fetch a value for from Wikidata.
 * If that has a value, such as "New York", the code will return.
 * If there is no value returned from Wikidata, the code returns nothing.
 * If there is no value returned from Wikidata, the code returns nothing.

Table
A table can be designed to display a row only when a particular property of the article exists on Wikidata.


 * for


 * for