Szablon:Ref/doc

Z Historia AGH
< Szablon:Ref
Wersja z dnia 15:50, 29 sty 2015 autorstwa MaciejZygmunt (dyskusja | edycje) (1 wersja)
(różn.) ← poprzednia wersja | przejdź do aktualnej wersji (różn.) | następna wersja → (różn.)

Szablon:Mbox

Ref-family templates

The {{ref}} family of templates is used to place labeled references and notes and references into an article, with the labels normally being clickable links for navigating from a ref to a corresponding note and back from the note to the ref. The links and backlinks are identified internally by combining the specified parameters. The templates take a variable number of unnamed parameters identified by their position and, optionally, a named parameter named noid which, if used, should be set by specifying it as "noid=noid".

Very simple example

Article Wikitext
Text that requires a footnote.{{ref|1|1}}

==Notes==
:1.{{note|1}}Body of the footnote.

Text that requires a footnote.1

Notes
1.^ Body of the footnote.

Labels must be unique

A common error when using {{ref}} is to use it multiple times with the same label. For example:

Text that requires a footnote.{{ref|1|1}}
Some other text that requires the same footnote.{{ref|1|1}}

==Notes==
:1.{{note|1}}Body of the footnote.

This generates two citations with the same label, which is |invalid HTML. To fix the problem, use multiple unique IDs.

Examples

Example:

Article text{{ref|reference_name_A|a}} more text{{ref|reference_name_B|b}} more text {{ref|reference_name_C|c|noid=noid}}.
*Bulleted text{{ref|reference_name_B|b|noid=noid}}
*Bulleted text{{ref|reference_name_C|c}}.
*
*intervening text
*
*{{note|reference_name_A|a}}Text for note a.
*{{note|reference_name_B|b}}Text for note b.
*{{note|reference_name_C|c|Text for note c (with extended highlighting).}}

This would produce:

Article texta more textb more text c.

  • Bulleted textb
  • Bulleted textc.
  • intervening text
  • ^a Text for note a.
  • ^b Text for note b.
  • ^c Text for note c (with extended highlighting).

Notice that the navigation back from the note to the ref does not work by clicking the backlink for refs which specify "noid=noid". In practice, if "noid=noid" is specified, it is usually specified for all refs having identical unnamed parameters, and navigation back to the associated ref is done by using the browser's "Back" button.

Also notice that browsers which support highlighting of link-accessed material highlight the active backlink by default, and that the highlighting has been extended to encompass the text for note c by specifying that text as a final template parameter instead of placing it outside of the template.

Table footnotes

One common application for {{ref}} and {{note}} templates is in placing footnotes below tables, as in the following example:

Year Regional GVAA Agriculture IndustryB ServicesC
County of Kent (excluding Medway)
1995 12,369 379 3.1% 3,886 31.4% 8,104 65.5%
2000 15,259 259 1.7% 4,601 30.2% 10,399 68.1%
2003 18,126 287 1.6% 5,057 27.9% 12,783 70.5%
Medway
1995 1,823 21 3.1% 560 31.4% 1,243 68.2%
2000 2,348 8 1.7% 745 30.2% 1,595 67.9%
2003 2,671 10 1.6% 802 27.9% 1,859 69.6%
^A Components may not sum to totals due to rounding
^B includes energy and construction
^C includes financial intermediation services indirectly measured

Alternative referencing style

Using ref/note tags is not the only way to do footnotes. Some people prefer to use Cite.php. Cite.php has many advantages, but is not mandatory.

See also