Template:Citeref/doc

From blackwiki
< Template:Citeref
Revision as of 16:50, 8 August 2020 by imported>Matthiaspaul (→‎Usage: CE)
Jump to navigation Jump to search

Description

This template can be used to create wiki links to citations defined through CS1/CS2 citation templates. It is a (partial) wrapper around {{harvid}} to make it easier to create links with small superscript labels (like [n]) similar to those created by Mediawiki's <ref>...</ref> style.

Usage

A typical use is inside of |quote=, if the quotation refers to other works defined as citations in the same article, but it can also be used in many other locations inside and outside of citation templates, including in other parameters.

By default, the template supports 1 to 4 author name parameters (as per {{harvid}} followed by 1 date parameter (also as per {{harvid}} to compose the appendage to CITEREF in order to match the internal anchor created by the citation template this link should point to. The last parameter is the label text that should be displayed as link text, f.e. "a", "b", "c", etc. While this does not affect the functionality make sure that these labels do not clash with other labels used for citations or notes in the same article in order to avoid confusion for users.

If only one parameter is given, the label text will be the same.

The optional named parameter |style=plain can be used to switch the display style from the default superscript labels to plain text.

While it is possible to create direct piped links like [[#CITEREFnamedate|label]], usage of the template is preferred as it hides the internal CITEREF anchor composing details away from the user and since it can be centrally updated it is easier to maintain in the future than adjusting hardcoded links. Also, in the case of superscript labels, the template ensures a consistent appearance and safe coding usable inside of citations without the user having to remember HTML syntax etc. to achieve the effect.

Using the optional |ref= or |id= parameters the template can also be used to support other anchor name styles in order to support special cases.

In order to avoid dangling links, please check the links by clicking on them after creation and when changing the author/editor names or dates in the corresponding citations. (A future version of the template might automatically detect dangling links and throw error messages, see Module talk:Footnotes/Archive 1#broken harv link reporting and Help talk:Citation Style 1/Archive 66#make ref=harv the default for CS1.)

Examples

Example reference definitions:[1][2]

  • <ref name="Example_Ref_1">{{cite book |title=Title |author=Author |date=2019 |quote=Example text referring to another citation{{citeref|Author|2020|b}}.}}</ref>
  • <ref name="Example_Ref_2">{{cite book |title=Title |author=Author |date=2020 |quote=Example text referring to {{citeref|Author|2019|another citation|style=plain}}.}}</ref>
  • {{citeref|Author|2019|a}}:
Example text[a]
  • {{citeref|Author|2019|text|style=plain}}:
Example text

Using the |ref= or |id= parameters, the template can also be used to create links to two other anchor naming styles. If one of them is given, this will override the Harvard anchor naming scheme by {{harvid}} and the template will accept only one unnamed parameter (for the link label text). If both parameters are given, |id= will be ignored:[3]

  • |ref= can be used to link to completely free-style anchors (f.e. to override the default harv scheme if this is found too complicated to follow in specific cases). The values "harv" and "none" are reserved and must not be used.
  • |id= works similar but automatically prefixes the anchor name by "Reference-". (See {{wikicite}} for details.)
  • {{citeref|c|ref=Author-2020}}:
Example text[c]
  • {{citeref|text|ref=Author-2020|style=plain}}:
Example text
  • {{citeref|d|id=Example}}:
Example text[d]
  • {{citeref|text|id=Example|style=plain}}:
Example text

There isn't much point in combining |ref= or |id= with |style=plain because the syntax is more complicated than a piped link like [[#anchor-name|label]], however, this is supported for cases where it is desirable for maintenance reasons to use the same link style (that is, linking through citeref) in an article rather than to mix different methods and syntaxes.

See also

References

  1. Author (2019). Title. Example text referring to another citation[b].
  2. Author (2020). Title. Example text referring to another citation.
  3. Author (2020). Title. Example text referring to another citation[c].