Difference between revisions of "Template:Formatter link/doc"
imported>RexxS m (sp) |
imported>RexxS (→Example: if Wikidata changes of the formatter url should be tracked) |
||
| Line 15: | Line 15: | ||
The formatter url to use for {{q|P267}} can be found from: | The formatter url to use for {{q|P267}} can be found from: | ||
* <code><nowiki>{{wdib |P1630 |qid=P267 |fwd=ALL |osd=n}}</nowiki></code> → {{wdib |P1630 |qid=P267 |fwd=ALL |osd=n}} | * <code><nowiki>{{wdib |P1630 |qid=P267 |fwd=ALL |osd=n}}</nowiki></code> → {{wdib |P1630 |qid=P267 |fwd=ALL |osd=n}} | ||
| − | In infoboxes, it will generally be hard-coded because it is specific to the infobox field. | + | 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: |
| + | *<code><nowiki>{{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}} }}</nowiki></code> | ||
<includeonly>{{sandbox other|| | <includeonly>{{sandbox other|| | ||
Revision as of 22:32, 15 November 2018
| 40px | This is a documentation subpage for Template:Formatter link. It contains usage information, categories and other content that is not part of the original template page. |
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, which uses the code as display.
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}} }}→ Template:Wdib Template:Wdib
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}}→ Template:Wdib
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}} }}