Template:Citeref/doc
{{#ifeq:doc |doc
|
{{#ifeq:show |show
|
40px | This is a documentation subpage for Template:Terminate sentence It contains usage information, categories and other content that is not part of the original {{#if: |{{{text2}}} |{{#if: |{{{text1}}} |{{#ifeq:Template |User |template template page |{{#if:Template |template page|article}}}}}}}}. |
}}{{#if: | | {{#ifexist:Template:Citeref | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]] | }} }} | }}
{{#if:{{#ifeq: |n|Stop hand nuvola.svg}} |[[File:{{#ifeq: |n|Stop hand nuvola.svg}}|40px|Notice|alt=]]}} | {{#if: | ' }}{{#ifeq: |n
|This template should not be used in citation templates such as Citation Style 1 and Citation Style 2, because it includes markup that will pollute the COinS metadata they produce; see Wikipedia:COinS. {{#if:{{#ifeq:doc|sandbox|1}}{{#ifeq:doc|doc|1}}||}} |This template is safe for use in citation templates that produce COinS metadata; see Wikipedia:COinS. If HTML or other markup is added, then the template must be reevaluated.}} | {{#if: |{{{imageright}}} |{{#if: |Template:Ombox/shortcut}} }} |
Description[edit source]
This template can be used to create wiki-links to existing citations defined in the same article through CS1/CS2 (and many other) citation templates. It is a (partial) wrapper around {{harvid}} to make it easier to create links in a consistent format. By default, links will be styled as small superscript labels (like [n]) similar to those created by Mediawiki's <ref>...</ref>
tags, but plain text links are possible as well.
A typical use is inside of |{{SAFESUBST:#if:quote|quote=}}
, if the quotation refers to other works defined as citations in the same article, but the template can also be used in many other locations inside and outside of citation templates, including in other parameters.
While it is possible to create direct piped links like [[#CITEREF<name-list><year><disambiguator>|<label>]]
, usage of the template is preferred as it hides the internal CITEREF-anchor-composing details away from the user. Since the template can be centrally updated it is easier to maintain in the future than adjusting hardcoded links all over the place. 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.
Usage[edit source]
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 unnamed parameter is the label text that should be displayed as link text, e.g. "a", "b", "c", etc.
While this does not affect the functionality please 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 (that is, if small letters or Arabic numbers are already used, you could e.g. use capital letters or Roman numbers instead). Also, since the sequence of labels in an article may change when additional links are added or the arrangement of citations changes, it might be beneficial to use a citation-relative numbering scheme (e.g. (re-)start with "A" in each new citation) instead of having to frequently renumber an article-wide absolute name scheme (e.g. starting with "A" in the first citeref link in an article).
If only one parameter is given, the label text will be the same.
The optional named parameter |{{SAFESUBST:#if:style|style=}}plain
can be used to switch the display style from the default superscript labels to plain text.
Using the optional |{{SAFESUBST:#if:ref|ref=}}
or |{{SAFESUBST:#if:id|id=}}
parameters the template can be used for 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[edit source]
Example reference definitions:[1][2]
Example 1:
Example text{{citeref|Author2|2018|a}}
:
- Example text{{#ifeq:|plain||}}{{#if:|{{#ifeq:|plain||[}}Author2{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:a|{{#ifeq:|plain||[}}a{{#ifeq:|plain||]}}|{{#if:2018|{{#ifeq:|plain||[}}2018{{#ifeq:|plain||]}}|{{#if:Author2|{{#ifeq:|plain||[}}Author2{{#ifeq:|plain||]}}}}}}}}}}}}}}}}{{#ifeq:|plain||}}
Example 2:
Example {{citeref|Author1|2017|text|style=plain}}
:
- Example {{#ifeq:plain|plain||}}{{#if:|{{#ifeq:plain|plain||[}}Author1{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:text|{{#ifeq:plain|plain||[}}text{{#ifeq:plain|plain||]}}|{{#if:2017|{{#ifeq:plain|plain||[}}2017{{#ifeq:plain|plain||]}}|{{#if:Author1|{{#ifeq:plain|plain||[}}Author1{{#ifeq:plain|plain||]}}}}}}}}}}}}}}}}{{#ifeq:plain|plain||}}
Using the |{{SAFESUBST:#if:ref|ref=}}
or |{{SAFESUBST:#if:id|id=}}
parameters, the template can also be used to create links following two other anchor-naming styles. If one of them is given, this will override the default 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, |{{SAFESUBST:#if:id|id=}}
will be ignored:[3][4]
|{{SAFESUBST:#if:ref|ref=}}
can be used to link to completely free-style anchors (e.g. 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.
|{{SAFESUBST:#if:id|id=}}
works similar but automatically prefixes the anchor name by "Reference-". (See {{wikicite}} for details.)
Example 3:
Example text{{citeref|b|ref=Author-2020}}
:
- Example text{{#ifeq:|plain||}}{{#if:Author-2020|{{#ifeq:|plain||[}}b{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:b|{{#ifeq:|plain||[}}b{{#ifeq:|plain||]}}}}}}}}}}}}}}}}{{#ifeq:|plain||}}
Example 4:
Example {{citeref|text|ref=Author-2020|style=plain}}
:
- Example {{#ifeq:plain|plain||}}{{#if:Author-2020|{{#ifeq:plain|plain||[}}text{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:text|{{#ifeq:plain|plain||[}}text{{#ifeq:plain|plain||]}}}}}}}}}}}}}}}}{{#ifeq:plain|plain||}}
Example 5:
Example text{{citeref|c|id=Example}}
:
- Example text{{#ifeq:|plain||}}{{#if:Example|{{#ifeq:|plain||[}}c{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:c|{{#ifeq:|plain||[}}c{{#ifeq:|plain||]}}}}}}}}}}}}}}}}{{#ifeq:|plain||}}
Example 6:
Example {{citeref|text|id=Example|style=plain}}
:
- Example {{#ifeq:plain|plain||}}{{#if:Example|{{#ifeq:plain|plain||[}}text{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:text|{{#ifeq:plain|plain||[}}text{{#ifeq:plain|plain||]}}}}}}}}}}}}}}}}{{#ifeq:plain|plain||}}
There isn't much point in combining |{{SAFESUBST:#if:ref|ref=}}
or |{{SAFESUBST:#if:id|id=}}
with |{{SAFESUBST:#if:style|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[edit source]
- {{harvid}}
- {{refn}} (a different method to create nested links working on <ref></ref> markup level rather than on citation template anchor level)
- {{r}} (a different method to create nested links working on <ref></ref> markup level rather than on citation template anchor level)
- Wikipedia:Citation templates
- Wikipedia:Nesting footnotes
References[edit source]
{{reflist|refs=
<ref name="Example_Ref_1">{{cite book |title=Title1 |author=Author1 |date=2017 |quote=Quote1 referring to another citation via CITEREF.{{citeref|Author2|2018|A}}}}</ref>
<ref name="Example_Ref_2">{{cite book |title=Title2 |author=Author2 |date=2018 |quote=Quote2 referring to {{citeref|Author1|2017|another citation|style=plain}} via CITEREF.}}</ref>
<ref name="Example_Ref_3">{{anchor|Reference-Example}}{{cite book |title=Title3 |author=Author3 |date=2019 |quote=Quote3 referring to another citation via CITEREF.{{citeref|Author4|2020|B}}}}</ref>
<ref name="Example_Ref_4">{{anchor|Author-2020}}{{cite book |title=Title4 |author=Author4 |date=2020 |quote=Quote4 referring to {{citeref|Author3|2019|another citation|style=plain}} via CITEREF.}}</ref>
}}
| {{#iferror: {{#ifexpr: 1 > 1 }} |column-width: {{{1}}};}} | {{#if: |column-width: {{{colwidth}}};}} }} {{#if:||{{#if:|list-style-type: {{{liststyle}}};}}}}"}}>
- ↑ Author1 (2017). Title1.
Quote1 referring to another citation via CITEREF.{{#ifeq:|plain||}}{{#if:|{{#ifeq:|plain||[}}Author2{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:A|{{#ifeq:|plain||[}}A{{#ifeq:|plain||]}}|{{#if:2018|{{#ifeq:|plain||[}}2018{{#ifeq:|plain||]}}|{{#if:Author2|{{#ifeq:|plain||[}}Author2{{#ifeq:|plain||]}}}}}}}}}}}}}}}}{{#ifeq:|plain||}}
{{cite book}}
:|author=
has generic name (help) - ↑ Author2 (2018). Title2.
Quote2 referring to {{#ifeq:plain|plain||}}{{#if:|{{#ifeq:plain|plain||[}}Author1{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:another citation|{{#ifeq:plain|plain||[}}another citation{{#ifeq:plain|plain||]}}|{{#if:2017|{{#ifeq:plain|plain||[}}2017{{#ifeq:plain|plain||]}}|{{#if:Author1|{{#ifeq:plain|plain||[}}Author1{{#ifeq:plain|plain||]}}}}}}}}}}}}}}}}{{#ifeq:plain|plain||}} via CITEREF.
{{cite book}}
:|author=
has generic name (help) - ↑ Author3 (2019). Title3.
Quote3 referring to another citation via CITEREF.{{#ifeq:|plain||}}{{#if:|{{#ifeq:|plain||[}}Author4{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:|{{#ifeq:|plain||[}}{{#ifeq:|plain||]}}|{{#if:B|{{#ifeq:|plain||[}}B{{#ifeq:|plain||]}}|{{#if:2020|{{#ifeq:|plain||[}}2020{{#ifeq:|plain||]}}|{{#if:Author4|{{#ifeq:|plain||[}}Author4{{#ifeq:|plain||]}}}}}}}}}}}}}}}}{{#ifeq:|plain||}}
{{cite book}}
:|author=
has generic name (help) - ↑ Author4 (2020). Title4.
Quote4 referring to {{#ifeq:plain|plain||}}{{#if:|{{#ifeq:plain|plain||[}}Author3{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:|{{#ifeq:plain|plain||[}}{{#ifeq:plain|plain||]}}|{{#if:another citation|{{#ifeq:plain|plain||[}}another citation{{#ifeq:plain|plain||]}}|{{#if:2019|{{#ifeq:plain|plain||[}}2019{{#ifeq:plain|plain||]}}|{{#if:Author3|{{#ifeq:plain|plain||[}}Author3{{#ifeq:plain|plain||]}}}}}}}}}}}}}}}}{{#ifeq:plain|plain||}} via CITEREF.
{{cite book}}
:|author=
has generic name (help)