Changes

Jump to: navigation, search

Template:Wikidata ID line

1,579 bytes added, 05:31, 24 July 2018
add support for IDs without formatting URLs
{{#if:{{{1|}}}|<!--
We have an ID to check
-->{{#if:{{#Property:{{{1|}}}|from={{{qid|}}}}}|<!--
We have a value to use
-->{{#if:{{#invoke:Wd|property|Property:{{{1|}}}|P1630}}|<!--
This is the URL-formatted version-->[<!--
We need to grab the property URL
-->{{replace text|{{#invoke:Wd|property|Property:{{{1|}}}|P1630}}|$1|<!--
and subst in the ID value - replacing spaces in the ID value with %20's so the URL still works
-->{{replace text|{{replace text|{{#invoke:WikidataIB|getPreferredValue|{{{1|}}}|name=id|qid={{{qid|}}}|fetchwikidata=ALL|onlysourced=no|noicon=yes|maxvals=1}}| |%20}}|*|&#42;}}<!--
That's the end of the URL
-->}} {{#ifeq:{{{showid|yes}}}|yes|{{#invoke:WikidataIB |getLabel |{{{1|}}}|FETCH_WIKIDATA}}|{{replace text|{{#invoke:WikidataIB |getLabel |{{{1|}}}|FETCH_WIKIDATA}}| ID| }}}}<!--
Show the ID as well?
-->{{#ifeq:{{{showid|yes}}}|yes|<nowiki>:</nowiki> {{replace text|{{#invoke:WikidataIB|getPreferredValue|{{{1|}}}|name=id|qid={{{qid|}}}|fetchwikidata=ALL|onlysourced=no|noicon=yes|maxvals=1}}|*|&#42;}} }}]|<!--
This is the non-URL-formatted version
-->{{#ifeq:{{{showid|yes}}}|yes|{{#invoke:WikidataIB |getLabel |{{{1|}}}|FETCH_WIKIDATA}}|{{replace text|{{#invoke:WikidataIB |getLabel |{{{1|}}}|FETCH_WIKIDATA}}| ID| }}}}<!--
Show the ID as well?
-->{{#ifeq:{{{showid|yes}}}|yes|<nowiki>:</nowiki> {{replace text|{{#invoke:WikidataIB|getPreferredValue|{{{1|}}}|name=id|qid={{{qid|}}}|fetchwikidata=ALL|onlysourced=no|noicon=yes|maxvals=1}}|*|&#42;}} }}<!--
... and we're all done!
-->}} }} }}<noinclude>
{{documentation}}
</noinclude>
Anonymous user

Navigation menu