• Home
  • Random
  • Recent changes
  • Special pages
  • Settings
  • About MOASSpedia
  • Disclaimers
MOASSpedia
  • 216.73.216.154
  • Talk
  • Watchlist
  • Contributions
  • Log in

Template:Formatter link

Template Discussion
  • Language
  • Watch
  • History
  • Edit
    • Page information
    • Permanent link
    • What links here
Template documentation[view] [edit] [history] [purge]

Wikidata contains many examples of "External identifiers" such as Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (P267) – see Anatomical Therapeutic Chemical Classification System.

These codes are used with Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (P1630) such as http://www.whocc.no/atc_ddd_index/?code=$1 where the $1 is to be substituted by the ATC code.

This template takes an external identifier code as |code= and uses a formatter url as |url= to construct a link to the external resource; an optional |label= parameter sets the text of the link, defaulting to the value of |code= otherwise.

Supplying the code as a parameter to this template allows one call to be made to Wikidata to fetch the code.

Example

For Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q26979), Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (P267):

  • {{Formatter link |url=http://www.whocc.no/atc_ddd_index/?code=$1 |code={{wdib |P267 |qid=Q26979 |fwd=ALL |osd=n |noicon=y |maxvals=1}} }} →

The formatter url to use for Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (P267) can be found from:

  • {{wdib |P1630 |qid=P267 |fwd=ALL |osd=n}} →

In infoboxes, it will generally be hard-coded because it is specific to the infobox field. Otherwise the following can be used if Wikidata changes of the formatter url should be tracked:

  • {{Formatter link |url={{wdib |P1630 |qid=P267 |fwd=ALL |osd=n |noicon=y}} |code={{wdib |P267 |qid=Q26979 |fwd=ALL |osd=n |noicon=y |maxvals=1}} }}

See also

  • {{Wikidata ID}} and {{Wikidata ID line}}
  • {{format link}}, a similarly-named but completely unrelated template

Template data

Combines a Wikidata “formatter URL (P1630)” with an id code to produce a URL

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
codecode

the unique ID value of the target page

Unknownrequired
urlurl

the Wikidata “formatter URL (P1630)”

Unknownrequired
labellabel

the text of the link (defaults to the value of “code”)

Unknownoptional
The above documentation is transcluded from Template:Formatter link/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://moasspedia.org/w/index.php?title=Template:Formatter_link&oldid=17008"
Categories:
  • Pages with script errors
  • Wikidata templates
Last edited on 26 October 2021, at 12:21

MOASSpedia

Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • This page was last edited on 26 October 2021, at 12:21.
  • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • Privacy policy
  • About MOASSpedia
  • Disclaimers
  • Desktop