Module:Wikidata/doc
Appearance
This module is a draft of statement formatting tool for Wikidata
formatStatements
[edit]Allows to format statement(s) for a specific property of the item related to the current page (we can't access to the other items currently).
Parameters:
- property
- The id of the property like "p18". Uppercase, like "P18", is allowed too. Required.
- separator
- If there are several values for the same property, this is used to separate the values. Default value is a comma (as specified at MediaWiki:Comma-separator)
- conjunction
- The conjunction is the last separator. Dafault value is "and" (as specified at MediaWiki:And)
- value-module
- Name of the module to call to format the value
- value-function
- name of the function of value-module called to format the value. It takes two parameters: the value and an array containing the paramters passed to the formatStatements function. For examples see Module:Wikidata/Formatters
- pattern
- pattern to use for each statement value if the value is a string or a commons image. The "$1" string is replace by the value. By example, {{#invoke:Wikidata|formatStatements|property=p373|pattern=[[commons:Category:$1|$1]]}} will output Germany (wikicode: [[commons:Category:Germany|Germany]]).
- rank
- Filter the statements according to their ranks. Possible values:
- one: output only one statement. The first statement found with the higher rank is used.
- all: output all values
- normal: output only statements rank "normal" or "preferred" (default value, currently all statements are seen as "normal" before the introduction of the rank feature in Wikidata)
- preferred: output statements with rank "preferred" (not available currently)
Note
[edit]You shouldn't use this module like [[commons:Category:{{#invoke:Wikidata|formatStatements|property=p373|pattern=}}]] because there is no assurance that there is only one statement in Wikidata for the given property. You should use instead {{#invoke:Wikidata|formatStatements|property=p373|pattern=[[commons:Category:$1|$1]]}} (or {{#invoke:Wikidata|formatStatements|property=p373|pattern=[[commons:Category:$1|$1]]|rank=one}} if you want only one link).
Examples
[edit]- d:q260: {{#invoke:Wikidata|formatStatements|property=p20}} that outputs Paris
- d:q7742: {{#invoke:Wikidata|formatStatements|property=p40}}
- d:q183: {{#invoke:Wikidata|formatStatements|property=p373|pattern=[[commons:Category:$1|$1]]}} that outputs Germany
- d:q260: {{#invoke:Wikidata|formatStatements|property=p214|pattern=[http://viaf.org/viaf/$1 $1]}} that outputs 34454460
Notes
[edit]
Links
[edit]This is the documentation page for Module:Wikidata