Module:WikidataIB/sandbox1/doc: Difference between revisions

Content deleted Content added
Parameters to getValue: clarify 'show' usage
Specific value-type handlers: update changes to link/pre/postfix
Line 235:
The third class of data types may be used with the parameters:
* {{para|prefix}}, {{para|postfix}}, {{para|linkprefix}}, {{para|linkpostfix}}
If you don't supply at least one of {{para|linkprefix}} or {{para|linkpostfix}}, then just {{para|prefix}} and {{para|postfix}} are used. For example, when getting the {{Q|P717}} in {{Q|Q532127|}}:
* <code><nowiki>{{#invoke:WikidataIB/sandbox|getValue|P717|fetchwikidata=ALL|onlysourced=no |prefix="before " |postfix=" after" |qid=Q532127}}</nowiki></code> → {{#invoke:WikidataIB/sandbox |getValue |P717 |fetchwikidata=ALL|onlysourced=no |prefix="before " |postfix=" after" |qid=Q532127}}
Use double-quotes to enclose the parameter value if it has leading or trailing spaces (otherwise they are stripped out). If you supply {{para|linkprefix}} or {{para|linkpostfix}}, then all four parameters are used and a link is made for each value like this:
* <code><nowiki>[[ linkprefix WikidataValue1 linkpostfix | prefix WikidataValue1 postfix]], [[ linkprefix WikidataValue2 linkpostfix | prefix WikidataValue2 postfix]], etc.</nowiki></code>
That allows multiple links to be made to different sections of a list article, such as [[List of observatory codes]]. For example, when getting the {{Q|P717}} in {{Q|Q532127|}} we can make the links:
*<code><nowiki>{{#invoke:WikidataIB/sandbox|getValue|P717|fetchwikidata=ALL|onlysourced=no |prefix= |postfix= |linkprefix="List of observatory codes#" |linkpostfix= |qid=Q532127}}</nowiki></code> → {{#invoke:WikidataIB/sandbox|getValue|P717|fetchwikidata=ALL|onlysourced=no |prefix= |postfix= |linkprefix="List of observatory codes#" |linkpostfix= |qid=Q532127}}
 
The parameters {{para|prefix}}, {{para|postfix}}, {{para|linkprefix}}, {{para|linkpostfix}} are also applied to wikibase-items if they are linked.
 
==== Formatting multiple returned values ====