Template:R/doc

From TakeApartWiki
< Template:R
Revision as of 16:28, 6 September 2018 by Martina (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Intent[edit]

Provides a simple wrapper for up to nine consecutive <ref name="RefName" /> citation tags that minimizes visual impact on the text which, along with the simpler syntax, increases code readability and ease of editing.

Comparison to <ref>[edit]

Note how much shorter the coding is when using {{r}}.

Using <ref> For example, fact<ref name=RefName/><ref name=Bam/><ref name=Bar/> and fact.<ref name=Bas/><ref name=Bay/><ref name=Baz/>

Displays as: For example, fact[1][2][3] and fact.[4][5][6]

Using {{r}} For example, fact{{r|RefName|Bam|Bar}} and fact.{{r|Bas|Bay|Baz}}

Displays as: For example, fact[1][2][3] and fact.[4][5][6]

References using {{r}} and references using <ref> can coexist on the same page.

Usage[edit]

Usage Display Notes
{{r|RefName}} Text.[1] Equivalent to <ref name="RefName" />.
{{r|RefName|p=100}}

{{r|RefName|pp=100}}

{{r|RefName|page=100}}

{{r|RefName|pages=100}}

Text.[1]:100 Adds a page number (or other location identifier) within the source.

The |p=, |pp=, |page=, and |pages= parameters are equivalent.

If the article cites only one location in a given source, reduce clutter by coding simply {{r|RefName}} and integrating the location into the main RefName citation.

{{r|RefName|p=10–14}}

{{r|RefName|pp=3, 6}}

{{r|RefName|page=§C}}

{{r|RefName|pages=Dust jacket}}

{{r|RefName|pages=para. 7}}

Text.[1]:10–14

Text.[1]:3, 6

Text.[1]:§C

Text.[1]:Dust jacket

Text.[1]:para. 7

{{r|RefName|Bam|Bar}} Text.[1][2][3] Equivalent to {{r|RefName}}{{r|Bam}}{{r|Bar}} or <ref name=RefName/><ref name=Bam/><ref name=Bar/>.

Up to nine references may be "bundled" this way.

{{r|1=RefName|2=Bam|3=Bar|4=Bas|p1=100|p2=10–14|p4=§C}}

{{r|1=RefName|p1=100|2=Bam|p2=10–14|3=Bar|4=Bas|p4=§C}}

Text.[1]:100[2]:10–14[3][4]:§C Equivalent to {{r|RefName|p=100}}{{r|Bam|p=10–14}}{{r|Bar}}{{r|Bas|p=§C}}.

In the example, not all references have pages; make sure that e.g. |1= matches |p1=

{{r|group=Notes|NtName}}

{{r|grp=Notes|NtName|NtCam}}

{{r|g=Notes|NtName|p=13}}

Text.[Notes 1]

Text.[Notes 1][Notes 2]

Text.[Notes 1]:13

The |group=, |grp=, and |g= parameters are equivalent and echo <ref group=Notes name=NtName/>.

If present, the parameter applies to all references in the template.

{{r|RefName|p=100|q=quote from the text}}

{{r|RefName|p=100|quote=quote from the text}}

Text.[1]:100 Makes sense only if |p= (or one of its synonyms) is present. |quote= (or |q=) underlines the superscript page number/​location identifier, signaling availability of a quote from the source, which pops up when the mouse is hovered over the underlined bit.
{{r|1=RefName|2=Bam|3=Bar|4=Bas|p1=100|p2=10–14|p4=§C|q1=Quote from 100|q4=Quote from §C}} Text.[1]:100[2]:10–14[3][4]:§C In the example, not all references have quotes; make sure that e.g. |1= and |p1= and |q1= all match.

The ref names must be defined; this is normally done in a References section (as demonstrated below). The separate Notes section is also illustrated.

===References===
{{reflist|refs=
<ref name=RefName>Reference text.</ref>
<ref name=Bam>Bam reference text.</ref>
<ref name=Bar>Bar reference text.</ref>
<ref name=Bas>Bas reference text.</ref>
<ref name=Bay>Bay reference text.</ref>
<ref name=Baz>Baz reference text.</ref>
}}

===Notes===
{{reflist|group=Notes|refs=
<ref name=NtName>Note text.</ref>
<ref name=NtCam>Cam note text.</ref>
}}

Resulting in:

References
  1. 1.00 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 1.12 Reference text.
  2. 2.0 2.1 2.2 2.3 2.4 Bam reference text.
  3. 3.0 3.1 3.2 3.3 3.4 Bar reference text.
  4. 4.0 4.1 4.2 4.3 Bas reference text.
  5. 5.0 5.1 Bay reference text.
  6. 6.0 6.1 Baz reference text.
Notes
  1. 1.0 1.1 1.2 Note text.
  2. Cam note text.

TemplateData[edit]

This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly error report for this template.

TemplateData for R

<templatedata> { "params": { "1": { "label": "Reference name 1", "description": "If this is \"RefName\", the template displays [1].", "type": "string", "required": true }, "2": { "label": "Reference name 2", "description": "If this is \"RefName\", the template displays [1].", "type": "string", "suggested": true }, "3": { "label": "Reference name 3", "description": "If this is \"RefName\", the template displays [1].", "type": "string", "suggested": true }, "4": { "label": "Reference name 4", "description": "If this is \"RefName\", the template displays [1].", "type": "string" }, "5": { "label": "Reference name 5", "description": "If this is \"RefName\", the template displays [1].", "type": "string" }, "6": { "label": "Reference name 6", "description": "If this is \"RefName\", the template displays [1].", "type": "string" }, "7": { "label": "Reference name 7", "description": "If this is \"RefName\", the template displays [1].", "type": "string" }, "8": { "label": "Reference name 8", "description": "If this is \"RefName\", the template displays [1].", "type": "string" }, "9": { "label": "Reference name 9", "description": "If this is \"RefName\", the template displays [1].", "type": "string" }, "group": { "aliases": [ "g", "grp" ], "label": "Reference group", "description": "The reference group of all the references displayed; see WP:REFGROUP for help.", "type": "string", "default": "Defaults to not being in a group.", "suggested": true }, "page1": { "aliases": [ "p", "page", "pages", "pp", "p1", "pages1", "pp1" ], "label": "Pages number(s): reference 1", "description": "Adds a page number (or other location identifier) within the source. Note that you can also put this information in the original reference instead so it need only be stated once.", "example": "\"2\", \"34–38\", \"inside cover\"", "type": "content", "suggested": true }, "q1": { "aliases": [ "quote", "q", "quote1" ], "label": "Quote: reference 1", "description": "A quote from the source. Appears when hovering over the page number, so the page number must be specified.", "type": "string", "suggested": true }, "page2": { "aliases": [ "p2", "pages2", "pp2" ], "label": "Pages number(s): reference 2", "description": "Adds a page number (or other location identifier) within the source. Note that you can also put this information in the original reference instead so it need only be stated once.", "example": "\"2\", \"34–38\", \"inside cover\"", "type": "content" }, "q2": { "aliases": [ "quote2" ], "label": "Quote: reference 2", "description": "A quote from the source. Appears when hovering over the page number, so the page number must be specified.", "type": "string" }, "page3": { "aliases": [ "p3", "pages3", "pp3" ], "label": "Pages number(s): reference 3", "description": "Adds a page number (or other location identifier) within the source. Note that you can also put this information in the original reference instead so it need only be stated once.", "example": "\"2\", \"34–38\", \"inside cover\"", "type": "content" }, "q3": { "aliases": [ "quote3" ], "label": "Quote: reference 3", "description": "A quote from the source. Appears when hovering over the page number, so the page number must be specified.", "type": "string" }, "page4": { "aliases": [ "p4", "pages4", "pp4" ], "label": "Pages number(s): reference 4", "description": "Adds a page number (or other location identifier) within the source. Note that you can also put this information in the original reference instead so it need only be stated once.", "example": "\"2\", \"34–38\", \"inside cover\"", "type": "content" }, "q4": { "aliases": [ "quote4" ], "label": "Quote: reference 4", "description": "A quote from the source. Appears when hovering over the page number, so the page number must be specified.", "type": "string" }, "page5": { "aliases": [ "p5", "pages5", "pp5" ], "label": "Pages number(s): reference 5", "description": "Adds a page number (or other location identifier) within the source. Note that you can also put this information in the original reference instead so it need only be stated once.", "example": "\"2\", \"34–38\", \"inside cover\"", "type": "content" }, "q5": { "aliases": [ "quote5" ], "label": "Quote: reference 5", "description": "A quote from the source. Appears when hovering over the page number, so the page number must be specified.", "type": "string" }, "page6": { "aliases": [ "p6", "pages6", "pp6" ], "label": "Pages number(s): reference 6", "description": "Adds a page number (or other location identifier) within the source. Note that you can also put this information in the original reference instead so it need only be stated once.", "example": "\"2\", \"34–38\", \"inside cover\"", "type": "content" }, "q6": { "aliases": [ "quote6" ], "label": "Quote: reference 6", "description": "A quote from the source. Appears when hovering over the page number, so the page number must be specified.", "type": "string" }, "page7": { "aliases": [ "p7", "pages7", "pp7" ], "label": "Pages number(s): reference 7", "description": "Adds a page number (or other location identifier) within the source. Note that you can also put this information in the original reference instead so it need only be stated once.", "example": "\"2\", \"34–38\", \"inside cover\"", "type": "content" }, "q7": { "aliases": [ "quote7" ], "label": "Quote: reference 7", "description": "A quote from the source. Appears when hovering over the page number, so the page number must be specified.", "type": "string" }, "page8": { "aliases": [ "p8", "pages8", "pp8" ], "label": "Pages number(s): reference 8", "description": "Adds a page number (or other location identifier) within the source. Note that you can also put this information in the original reference instead so it need only be stated once.", "example": "\"2\", \"34–38\", \"inside cover\"", "type": "content" }, "q8": { "aliases": [ "quote8" ], "label": "Quote: reference 8", "description": "A quote from the source. Appears when hovering over the page number, so the page number must be specified.", "type": "string" }, "page9": { "aliases": [ "p9", "pages9", "pp9" ], "label": "Pages number(s): reference 9", "description": "Adds a page number (or other location identifier) within the source. Note that you can also put this information in the original reference instead so it need only be stated once.", "example": "\"2\", \"34–38\", \"inside cover\"", "type": "content" }, "q9": { "aliases": [ "quote9" ], "label": "Quote: reference 9", "description": "A quote from the source. Appears when hovering over the page number, so the page number must be specified.", "type": "string" } }, "description": "Provides a simple wrapper for up to nine consecutive [2] citation tags that minimizes visual impact on the text which, along with the simpler syntax, increases code readability and ease of editing.", "paramOrder": [ "group", "1", "page1", "q1", "2", "page2", "q2", "3", "page3", "q3", "4", "page4", "q4", "5", "page5", "q5", "6", "page6", "q6", "7", "page7", "q7", "8", "page8", "q8", "9", "page9", "q9" ] } </templatedata>

See also[edit]

  1. 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 Cite error: Invalid <ref> tag; no text was provided for refs named .5C.22RefName.5C.22
  2. Cite error: Invalid <ref> tag; no text was provided for refs named RefName