Toggle menu
15
236
70
27.5K
Kenshi Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 04:13, 17 February 2025 by Prd (talk | contribs) (Created page with "{{Documentation subpage}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see Wikipedia:Wikidata) --> {{Lua|Module:WikidataIB}} == Description == Emptyor tests a piece of text to ascertain whether it's effectively empty or contains some text. It is a wrapper for the function emptyor() in Module:WikidataIB. If the unnamed parameter consists only of html tags, punctuation (e.g. Wiki-markup) and whitespace, then...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Emptyor tests a piece of text to ascertain whether it's effectively empty or contains some text. It is a wrapper for the function emptyor() in Module:WikidataIB.

If the unnamed parameter consists only of html tags, punctuation (e.g. Wiki-markup) and whitespace, then Emptyor returns nothing; otherwise it returns the parameter unchanged.

In designing a Wikidata-enabled infobox, we may need to apply markup, such as italics, to a value fetched from Wikidata. However, if that value is blank, then the markup would normally produce a label with a blank entry for its data. Using this template will suppress such rows when nothing is returned from Wikidata.

Usage

Example:

label99 = This Field
data99  = 
	{{emptyor
		| <i>{{#invoke:WikidataIB |getValue |P666 |name=thisfield |qid={{{qid|}}} |suppressfields={{{suppressfields|}}} |fetchwikidata={{{fetchwikidata|}}} |onlysourced={{{onlysourced|}}} |noicon={{{noicon|}}} |list={{{list|}}} | {{{thisfield|}}} }}</i>
	}}

If the getValue call returns anything, the infobox will show a row labelled "This field", with the value returned in italics.

If the getValue call returns nothing, the infobox will not show the row "This field".