Permanently protected template

Template:Cite Q

From Vigyanwiki
Revision as of 14:13, 27 July 2023 by alpha>Revathy (1 revision imported)
Template documentation

Purpose

This template returns a formatted citation from statements stored on a Wikidata item (referred to by its Q identifier or QID) describing a citable source such as a scholarly article.

For example, Wikidata item Script error: The module returned a nil value. It is supposed to return an export table. (Q15625490) is a scholarly item. To cite this as a source:

{{Cite Q|Q15625490}}
No label or title -- debug: Q15625490, Wikidata Q15625490

You can read about the template in:

No label or title -- debug: Q104831003, Wikidata Q104831003

Note: While Wikipedia does not regard Wikidata as a reliable source, citations using Cite Q are not citing Wikidata; they cite the individual work stated, using metadata about that work, which is held on Wikidata for convenience.

Usage

A wrapper for {{Citation}}, which calls available values from Wikidata.

An example of an article using this template for all of its references is South Pole Telescope; an example using Harvard style citations is Suffix automaton.

By default, if there are more than eight author names, the template displays three, followed by "et al". This can be changed using |display-authors=; setting that parameter to all displays them all. The same applies to multiple editors – see the test-case pages.

Citations of papers which have been retracted (Script error: The module returned a nil value. It is supposed to return an export table. (P5824)) will appear in Category:Cite Q - cites a retracted work.

Citations of papers which have been replaced (Script error: The module returned a nil value. It is supposed to return an export table. (P1366)) will appear in Category:Cite Q - cites a replaced work.

You can also use {{Cite Q bulleted}} if you want to have a bullet returned before the citation (useful for automatic lists)

Parameters

  • |1= = Wikidata QID for the article

Additionally, any named parameter used in {{citation}} may be entered and will overwrite the value in Wikidata. Using such parameters, with a value of unset, will suppress display of data from Wikidata.

Blank

<ref name="">{{Cite Q| XXQIDXX }}</ref>

Reference naming

For ease of use, you may wish to name your references to reflect the cited work, for example:

<ref name="Williams-2010">{{Cite Q|Q15625490}}</ref>

Parameter / entity map

This section lists where each of the template's supported parameters gets its data.

Bibliographic parameters

Identifier parameters

Examples

{{Cite Q|Q15625490}}
No label or title -- debug: Q15625490, Wikidata Q15625490
{{Cite Q|Q15625490|page=42}}
No label or title -- debug: Q15625490, p. 42, Wikidata Q15625490
{{Cite Q|Q15625490|access-date=18 May 2017}}
No label or title -- debug: Q15625490, Wikidata Q15625490 {{citation}}: |access-date= requires |url= (help)
{{Cite Q|Q15625490|quote=lorem ipsum}}
No label or title -- debug: Q15625490, Wikidata Q15625490, lorem ipsum
{{Cite Q|Q25766745}}
No label or title -- debug: Q25766745, Wikidata Q25766745
{{Cite Q|Q25766745 |chapter=The Final Cut}} (with chapter specified)
Lua error in Module:Cite_Q at line 435: attempt to index field '?' (a nil value).
{{Cite Q|Q25766745 |pages=48-52}} (with pages)
Lua error in Module:Cite_Q at line 435: attempt to index field '?' (a nil value).
{{Cite Q|Q15625490|access-date=18 May 2017}}
No label or title -- debug: Q15625490, Wikidata Q15625490 {{citation}}: |access-date= requires |url= (help)
{{Cite Q|Q25766745|mode=cs1}}
No label or title -- debug: Q25766745. Wikidata Q25766745.
{{Cite Q|Q25766745|mode=cs2}}
No label or title -- debug: Q25766745, Wikidata Q25766745
{{Cite Q|Q25766745|author-mask=1}}
No label or title -- debug: Q25766745, Wikidata Q25766745
{{Cite Q|Q25766745|editor=unset}}
No label or title -- debug: Q25766745, Wikidata Q25766745

For an example of a bibliography, updated periodically by Listeriabot, see User:Mike Peel/publications.

For additional examples, see testcases and testcases/many names.

Workflow

The template used with a single parameter, the Q-number of the article on Wikidata, will produce a citation using the default display parameters from Template:Citation and the styling of the author and editor names as they are stored on Wikidata. This is rarely the same as required by the citation formatting in any given article. The guidance at WP:CITEVAR requires that editors match the formatting of citations that they add to that of the article where it is added. At present, {{Cite Q}} does not know what style the formatting in an article requires (although it is possible that common styles could be marked or recognised automatically as is done for date formatting).

The result is that editors using {{Cite Q}} must take care to preview their edits and ensure that the formatting rendered matches that of the rest of the article. The commonest formatting issues are:

  1. Order of editor names:
    A typical output might be:
    If that were used in an article that used "Last, First" format for author names, then the editor would have to supply those author names manually in the desired format. It's often worth previewing the citation in expanded form to show what is being passed to the actual citation template:
    • {{Cite Q |Q15625490 |expand=yes}}
    • {{Citation |id=Wikidata Q15625490 |title=No label or title -- debug: Q15625490}}
    That would make the author names (and author-links) easily available for copy and paste, followed by tweaking into the desired format:
    • {{Cite Q |Q15625490 |author6=Etnoyer, Peter |author4=Hoetjes, Paul |author7=Smith, Michael |author5=Toller, Wes |author3=van Tassell, James L |author-link2=Kent E. Carpenter |author1=Williams, Jeffrey T |author2=Carpenter, Kent E}}
    • Williams, Jeffrey T; Carpenter, Kent E; van Tassell, James L; Hoetjes, Paul; Toller, Wes; Etnoyer, Peter; Smith, Michael, No label or title -- debug: Q15625490, Wikidata Q15625490
  2. Punctuation:
    The separators between elements in the above citation is a comma, which is the default for a CS2-style format produced by {{Citation}}. Careful examination in a particular article will often show the separator punctuation to be a full stop (period). That may be selected by setting |mode=cs1:
    • {{Cite Q |Q15625490 |author6=Etnoyer, Peter |author4=Hoetjes, Paul |author7=Smith, Michael |author5=Toller, Wes |author3=van Tassell, James L |author-link2=Kent E. Carpenter |author1=Williams, Jeffrey T |author2=Carpenter, Kent E |mode=cs1}}
    • Williams, Jeffrey T; Carpenter, Kent E; van Tassell, James L; Hoetjes, Paul; Toller, Wes; Etnoyer, Peter; Smith, Michael. No label or title -- debug: Q15625490. Wikidata Q15625490.
    • Sometimes, the article will have author names with initials, and those initials are terminated with a full stop (period). It may be necessary to manually add or remove the punctuation in the author names to match the style of the target article (note: this does not apply to author-links, which match the title of the author's article):
    • {{Cite Q |Q15625490 |author6=Etnoyer, Peter |author4=Hoetjes, Paul |author7=Smith, Michael |author5=Toller, Wes |author3=van Tassell, James L. |author-link2=Kent E. Carpenter |author1=Williams, Jeffrey T. |author2=Carpenter, Kent E. |mode=cs1}}
    • Williams, Jeffrey T.; Carpenter, Kent E.; van Tassell, James L.; Hoetjes, Paul; Toller, Wes; Etnoyer, Peter; Smith, Michael. No label or title -- debug: Q15625490. Wikidata Q15625490.
  3. Italicisation in titles:
    Titles drawn from Wikidata cannot contain formatting, so editors using {{Cite Q}} may have to add appropriate formatting.
    {{Citation}} will automatically apply italicisation to titles of books, etc. so that does not need to be added:
    However, some titles require partial italicisation, and that has to be done manually when the whole title is not italicised, although that is rare. Titles of chapters may also need to be checked:

Module:Wd

Module:Wd can automatically cause this template to be invoked, e.g.,

{{Wikidata|references|raw|Q2978|P2046}}
Script error: The module returned a nil value. It is supposed to return an export table.

currently causes the following to be invoked:

{{Cite Q|Q15707237|pages=242}}
Lua error in Module:Cite_Q at line 435: attempt to index field '?' (a nil value).

because an Script error: The module returned a nil value. It is supposed to return an export table. (P2046) statement on Script error: The module returned a nil value. It is supposed to return an export table. (Q2978) is referenced to be Script error: The module returned a nil value. It is supposed to return an export table. (P248) Script error: The module returned a nil value. It is supposed to return an export table. (Q15707237) with Script error: The module returned a nil value. It is supposed to return an export table. (P304) = 242.

Issues

Future developments

  • Once robust the functionality should be merged into {{Citation}}
  • Eventually, each signed-in reader should be able to set, under their "Preferences", the style in which they wish to see citations rendered. No more CiteVar wars!
  • We should have a global template repository, so the code can be used by multiple wikis, without having to manually copy it after every update.

To do list

Deferred

Feel free to tackle these; the core team working on Cite Q sees them as low priority, or too complex.

  • Resolve special case of newspaper articles
    • Is the following topic of "hint parameters" related to this?
  • Author names (Western-style, at least) should display as "Last, First Middle" to match Wikipedia house style
    • How to deal with Tussenvoegsels etc.
      • In Romance languages, it should be, e.g., "Quental, Antero de" instead of "de Quental, Antero"
  • Handle volume in a serial
    • Clarification needed: What is meant by this? |part=, or output format differences journal vs. magazine?
  • Is there a Pxxxx code for book series editors to add them to the list of "normal" editors?
    • resolve at Wikidata first

Done

Won't fix

  • Improve date formatting options
  • Fix unnecessary piping of author/editor and journal links if link and label are the same, f.e. [[Author|Author]] -> [[Author]], [[Journal|Journal]] -> [[Journal]] for improved reusability, cleaniness of output, reduced size of resulting page code, and to avoid potential future extra text errors thrown by the underlying {citation} template
    • See talk
  • Fix invocation with |qid= instead of unnamed parameter. At present {{cite Q|qid=Q12345}} instead of {{cite Q|Q12345}} gives an error.
    • This is intended; please discuss on talk
    • Fix ready for test in template sandbox: {{cite Q/sandbox|qid=Q15625490}} gives Lua error in Module:Cite_Q/sandbox at line 13: attempt to index a nil value.
  • Replace the QID with a pen icon
    • The QID is valid metadata about the cited work.

See also

meta:WikiCite and d:Wikidata:WikiProject Source Metadata - goals of those projects include the management of citations across Wikimedia projects and better insight into research resources through Wikimedia projects.

Template data

Generate citations from Wikidata by passing the QID to this template

Template parameters

ParameterDescriptionTypeStatus
QID1

The Wikidata QID of the cited source

Stringrequired