Template:If then show/doc
< Template:If then show
Jump to navigation
Jump to search
Revision as of 11:51, 27 July 2018 by imported>RexxS (fix association lists)
| This is a documentation subpage for Template:If then show. It contains usage information, categories and other content that is not part of the original template page. |
This template tests whether the first unnamed parameter is not an empty string and returns it if it does. Otherwise it returns the second unnamed parameter.
This is useful when the first parameter is a {{#invoke: }} of a Lua module that may return a value or nothing. Because it uses the {{#invoke: }} just once, it simplifies the coding of infoboxes, for example.
Usage
- Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (P26) for Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q151973)
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}|unmarried}}→ unmarried
- Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (P26) for Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q905)
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}|unmarried}}→ unmarried