Module:Wikidata/doc: Difference between revisions

Content deleted Content added
update documentation to note returning empty string if wikidata has no value
Usage: update to agree with logic used
Line 6:
 
== Usage ==
* <code><nowiki>{{#invoke:{{BASEPAGENAME}}Sandbox/RexxS|getSpouse|}}</nowiki></code> = returns nothing, so suppresses the display of spouse in an infobox
* <code><nowiki>{{#invoke:{{BASEPAGENAME}}Sandbox/RexxS|getSpouse|FETCH_WIKIDATA}}</nowiki></code> = returns the linked value(s) of property P26 (spouse) stored in wikidata for the corresponding article (e.g. for article [[Bill Clinton]], it returns [[Hillary Rodham Clinton]])
* <code><nowiki>{{#invoke:{{BASEPAGENAME}}Sandbox/RexxS|getSpouse|[[Hillary Clinton]]}}</nowiki></code> = returns [[Hillary Clinton]], allowing an infobox to use a local value rather than the value stored in Wikidata.
 
Inside an infobox definition, it may be called like this:
* <code><nowiki>| data55 = {{#invoke:{{BASEPAGENAME}}Sandbox/RexxS|getSpouse|{{{spouse|FETCH_WIKIDATA}}} }}</nowiki></code>
which causes the infobox to:
# not display spouse if the infobox parameter <code>|spouse</code> is notset suppliedto be blank (as <code>"| spouse ="</code>}
# display the linked value(s) from Wikidata if the infobox parameter <code>|spouse</code> is setnot to be blank (as <code>"| spouse ="</code>}supplied
# display the local infobox parameter <code>|spouse</code> if it is supplied (e.g. <code>"|spouse = Hillary Clinton"</code>)