• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:Empty or

  • Template
  • Talk
  • Language
  • Watch
  • Edit
Template documentation[view] [edit] [history] [purge]
This template uses Lua:
  • Module:WikidataIB (sandbox)

Description

edit

This template 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 this template 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

edit

Example:

label99 = This Field
data99  = 
	{{empty or
		| <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".

The above documentation is transcluded from Template:Empty or/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Empty_or&oldid=1279717445"
Last edited on 10 March 2025, at 04:05

Languages

    • العربية
    • বাংলা
    • Bosanski
    • فارسی
    • ગુજરાતી
    • Bahasa Indonesia
    • മലയാളം
    • ଓଡ଼ିଆ
    • ਪੰਜਾਬੀ
    • தமிழ்
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 10 March 2025, at 04:05 (UTC).
    • Content is available under CC BY-SA 4.0 unless otherwise noted.
    • Privacy policy
    • About Wikipedia
    • Disclaimers
    • Contact Wikipedia
    • Code of Conduct
    • Developers
    • Statistics
    • Cookie statement
    • Terms of Use
    • Desktop