Help:References

From Teraurge
Jump to navigationJump to search

This is a ShoutWiki help page, hosted at ShoutWiki Hub. If you want to suggest changes, leave a message on its talk page. If you want to replace this page with a custom help page for your wiki, click the create button above.

References use Extension:Cite to provide in-line notes (frequently source citations, hence the extension name, but also explanatory or peripheral text) using <ref> tags, which result in superscripted indices (like this:[1]) and an indexed list of the notes, usually in a reference section near the bottom of the article. The default indices are decimal, which work without any special set-up. The extension supports naming, to reuse references, and grouping, to separate references by purpose or to specify the index type (e.g., decimal, lower-alpha, upper-alpha, lower-greek, lower-roman, and upper-roman).

Making simple references

The Cite extension comes with MediaWiki 1.21 and above and should already be installed on every wiki.

Editors should generally add reference text between <ref> tags directly after the information the references support, after any punctuation, without a space before the beginning of the <ref> tag, and usually (but not necessarily) at the end of the sentence.

The <references /> tag or a {{reflist}} template transclusion, which some wikis use to simplify reference list options and formatting, defines where the reference list appears. Any error messages on the content or formatting of a reference is reported with the reference list.

Mary<ref>Some note</ref> had a little lamb.<br />
Its fleece was white as snow;<ref>Some other note</ref><br />
And everywhere<ref>Yet more notes</ref> that Mary went<br />
The lamb was sure to go.

==References==
<references />

creates

Mary[1] had a little lamb.
Its fleece was white as snow;[2]
And everywhere[3] that Mary went
The lamb was sure to go.

References
  1. Some note
  2. Some other note
  3. Yet more notes

Some wikis may use citation templates to compile the details of a reference and to format punctuation and other markup, such as italics and quotation marks. Place such templates inside the <ref> tags.

Naming and grouping references

<ref> tags support the optional attributes name to reuse references and group to group references into separate lists, for example to separate explanatory notes from source citations or to separate references for tables or images from references for text. The sequence of indices is independent in each group.

To define a named reference (with optional group):

<ref name="name-value" group="group-value">content</ref>

To reuse a named reference (with optional group):

<ref name="name-value" group="group-value"/>

To list a group of references:

<references group="group-value"/>

Named references must be defined only once within each group, so that the name/group combination specifies only one reference. Name and group values must follow these rules:

  • Values are case-sensitive.
  • Values must not be purely numeric.
  • Quotation marks delimiting a value are optional (although still recommended for compatibility with XML syntax) if the only characters used in the value are letters A-Z, a-z, digits 0-9, and the symbols !$%&()*,-.:;<@[]^_`{|}~ (i.e., all printable ASCII characters except #"'/=>?\ and space).
    • The delimiters must be straight ASCII double quotes (").
    • Delimited values may not include a less-than sign (<) or a straight ASCII double quote (").
Mary<ref name="word">Some note</ref> had a little lamb.<br />
Its fleece was white as snow;<ref group="line">Some other note</ref><br />
And everywhere<ref name="word"/> that Mary went<br />
The lamb was sure to go.

==References==
<references />

==Line notes==
<references group="line"/>

creates

Mary[1] had a little lamb.
Its fleece was white as snow;[line 1]
And everywhere[1] that Mary went
The lamb was sure to go.

References
  1. a b Some note
Line notes
  1. Some other note

Notice that the in-line index prepends the group value.

Predefining references

Editors can define some or all of the references within the <reference> tag using names, then invoke them in the article content, to avoid cluttering the article text with the reference text.

Mary<ref name="n1"/> had a little lamb.<br />
Its fleece was white as snow;<ref name="n2"/><br />
And everywhere<ref name="n3"/> that Mary went<br />
The lamb was sure to go.

==References==
<references>
<ref name="n1">Some note</ref>
<ref name="n2">Some other note</ref>
<ref name="n3">Yet more notes</ref>
</references>

creates

Mary[1] had a little lamb.
Its fleece was white as snow;[2]
And everywhere[3] that Mary went
The lamb was sure to go.

References
  1. Some note
  2. Some other note
  3. Yet more notes

Creating non-decimal indices

The default indices on references are decimal, which work without any special set-up. There are a few pieces required to get non-decimal indices.

First, the extension can use MediaWiki: messages to index references within a group. A common and recommended practice is to use special-case groups named for their CSS list style types (lower-alpha, upper-alpha, lower-greek, lower-roman, and upper-roman). For a group named lower-alpha, for example, Administrators need to create MediaWiki:Cite link label group-lower-alpha and put in it (one long string, no wrapping):

a b c d e f g h i j k l m n o p q r s t u v w x y z

The string can extend as long as desired, with aa, ab, ac, ..., zx, zy, zz, aaa, aab, aac, ..., zzz, etc.

Next, Administrators need to create some CSS. The following example is simple. More complex CSS is also possible.

.lower-alpha ol {
	list-style-type: lower-alpha;
}

Preferably put the CSS in MediaWiki:Common.css so it applies to all skins.

Finally, when creating references, editors need to specify the special-case group name and wrap the reference list in a <div> with the special-case group name as its class.

Mary<ref group="lower-alpha">Some note</ref> had a little lamb.<br />
Its fleece was white as snow;<ref group="lower-alpha">Some other note</ref><br />
And everywhere<ref group="lower-alpha">Yet more notes</ref> that Mary went<br />
The lamb was sure to go.

==References==
<div class="lower-alpha"><references group="lower-alpha"/></div>

creates

Mary[a] had a little lamb.
Its fleece was white as snow;[b]
And everywhere[c] that Mary went
The lamb was sure to go.

References
  1. Some note
  2. Some other note
  3. Yet more notes

The <ref> tags pick up the group name and use the MediaWiki: message to index the references in the text. If there were not a MediaWiki: message corresponding to the group, then the extension would just prepend the string "lower-alpha," which is not desirable. The ordered list generated by <references/> uses the default list style of decimal, unless CSS changes it. Since editors cannot set an in-line style or class on the <ol> tag, they must wrap it with the <div>.

References

Portions of the text on this help page are based on:

See also: