User:Janhrach/new wd documentation

Minor changes:

  • Change the c footnote at the end of the "Claim class" subsection in the "Commands" section to:

See the section on references for details.

  • Change the description of the sourced flag in the "Configuration flags" subsection of the "Flags" section to:

Only returns claims that have at least one non-empty reference. (References having only ignored parameters are considered empty.)

New section (to be added after the "Commands" section):

References edit

When either the reference or the references command is used and a reference is encountered (in Wikidata), the module attempts to display it using the {{Cite web}} template. The reference to be displayed has to have at least title (P1476) and reference URL (P854) properties. The below table shows the mapping of Wikidata properties to parameters of Cite web.

Wikidata property Parameter of Cite web Notes
archive date (P2960) archive-date
archive URL (P1065) archive-url
author (P50) authorN N can be 1, 2, 3...
author name string (P2093)
language of work or name (P407) language Ignored when the same as the local language.
page(s) (P304) pages
publication date (P577) date
publisher (P123) publisher
quotation (P1683) quote
reference URL (P854) url
retrieved (P813) access-date
stated in (P248) website
title (P1476) title

The following properties are ignored: image (P18), imported from Wikimedia project (P143), inferred from (P3452), type of reference (P3865).

If a title (P1476) or a reference URL (P854) property is missing or the reference has unknown properties, the module attempts to display it using the {{Cite Q}} template. The stated in (P248) property is needed. It's used for the first (unnamed) parameter of Cite Q. The below table shows the mapping of other properties to Cite Q parameters.

Wikidata property Parameter of Cite Q Notes
chapter (P792) chapter
column (P3903) at
page(s) (P304) pages
publication date (P577) date
retrieved (P813) access-date
section, verse, paragraph, or clause (P958) section
title (P1476) title
any property of the "External identifier" data type id The label of the property is prepended before its content.

The properties listed under the first table (in this section) are also ignored when using Cite Q.

A reference could be displayed using Cite Q only if the reference has a stated in (P248) property and has only properties listed in the table above. If neither Cite web nor Cite Q could be used to display a reference, the following error is returned:

Error: Unable to display the reference properly. See the documentation for details.

To fix this error, check if the reference has the required properties and doesn't have any unknown properties, as described above. The Wikidata help page on references can also be helpful when sourcing statements.

Note for users copying this template/module to another wiki: The local names of the Cite web and Cite Q templates are fetched from the sitelinks of the Q5637226 or the Q22321052 item, respectively. If the local citation template isn't linked from its Wikidata item or it doesn't exist at all, this module skips attempting to display citations using it.