Difference between revisions of "Template:Reflist/doc"

From Super-wiki
Jump to: navigation, search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Ref-family templates==
+
Use this template to create a footnote-style reference list in an article.  The advantage to doing this using the Ref tag is that the wiki will take care of numbering and managing the references list, editors will not need to renumber an entire references list just to add one footnote mid-article.
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 ===
 
  
{| class=wikitable                 
+
== Four options for usage ==
!Article
 
!Wikitext
 
|-
 
|<pre>
 
Text that requires a footnote.{{ref|a|1}}
 
  
==Notes==
+
=== Option 1 (only specific/unique references) ===
:1.{{note|a}}Body of the footnote.
+
<pre>
 +
== Content ==
 +
 
 +
Lorem ipsum.<ref>season, episode, etc.</ref>
 +
 
 +
Lorem ipsum dolor sit amet.<ref>season, episode, etc.</ref>
 +
 
 +
== References ==
 +
 
 +
{{reflist}}
 
</pre>
 
</pre>
|{{quotation|
+
This will create an uniquely numbered footnote at the end of each sentence, which will be a working link to the references list at the end of the article.  The references themselves can also be links to other pages on the wiki, or even external pages.
Text that requires a footnote.{{ref|a|1}}
+
 
  
Notes
+
=== Option 2 (repeat references) ===
:1.{{note|a}}Body of the footnote.
+
<pre>
|}
+
== Content ==
  
The first parameter of ref is the label that has to be used for the parameter of the corresponding note. The second parameter is the marker of the resulting link as it will be shown on the page, as a superscript. The easiest choice is to make these two the same, but this is not a requirement.
+
Lorum ipsum.<ref>season, episode, etc.</ref>
  
=== Labels must be unique ===
+
Lorum ipsum dolor sit amet.<ref name="five01">season, episode, etc.</ref>
  
A common error when using ref is to use it multiple times with the same label. For example:
+
Lorum ipsum.<ref name"five01" />
  
<pre>
+
== References ==
Text that requires a footnote.{{ref|1|1}}
 
Some other text that requires the same footnote.{{ref|1|1}}
 
  
==Notes==
+
{{reflist}}
:1.{{note|1}}Body of the footnote.
 
 
</pre>
 
</pre>
 +
This will make numbered footnotes at the end of each sentence, but the number for the second and third footnotes would be the same since they refer to the same source material.  The advantage of doing this is less typing and therefore smaller page file size, especially when the reference is itself a link.  Note that reference ''name'' '''cannot''' be just an integer, ie. 501, it must start with an alphabetical character.
 +
 +
 +
=== Option 3 (only general references) ===
 +
<pre>
 +
== Content ==
  
This generates two citations with the same label, which is invalid HTML. To fix the problem, use multiple unique IDs.
+
Lorem ipsum.
  
=== Simple examples ===
+
Lorem ipsum dolor sit amet.
  
ref and note
+
== References ==
  
Example:
+
{{refbegin}}
<pre style="border:1; background:white; margin: 0; padding:0; line-height: 130%; word-wrap: break-word;
+
* general reference 1
white-space: -moz-pre-wrap;
+
* general reference 2
white-space:  -o-pre-wrap;
+
{{refend}}
white-space:    -pre-wrap;
 
white-space:      pre-wrap">
 
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).}}
 
 
</pre>
 
</pre>
 +
This makes a list of references at the end of the article, without any footnotes citing the references to specific text in the article.
 +
 +
 +
=== Option 4 (both specific and general references) ===
 +
<pre>
 +
== Content ==
  
This would produce:
+
Lorem ipsum.<ref>season, episode, etc.</ref>
<div style="margin: 1em; padding: 1em; border:1px solid #999">
 
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).}}
 
</div>
 
  
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.
+
Lorem ipsum dolor sit amet.<ref>season, episode, etc.</ref>
  
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.
+
Lorem ipsum.
  
=== More complex examples ===
+
Lorem ipsum dolor sit amet.
ref label pairs with note label.
 
The note label template will normally have identical parameters with the ref label with which it is paired, and is normally created by copying the ref, pasting it into the note location, and changing its name to "note label"; this avoids having parameters mismatched because of a typo. Navigation forward uses parameters 1 and 3, navigation backward uses parameters 1 and 2. Parameter 3 is optional, and note label has an optional fourth parameter.
 
  
Example:
+
== References ==
<pre style="border:1; background:white; margin: 0; padding:0; line-height: 130%; word-wrap: break-word;
 
white-space: -moz-pre-wrap;
 
white-space:  -o-pre-wrap;
 
white-space:    -pre-wrap;
 
white-space:      pre-wrap">
 
Article text{{ref label|reference_name_A|a|1}} more text{{ref label|reference_name_G|g|}} more text {{ref label|reference_name_B|b|2}} more text {{ref label|reference_name_C|c|3}} more text {{ref label|reference name_D|d|4}} more text {{ref label|reference name_E|e|none}} more text {{ref label|reference name_F|f|}} more text {{ref label|reference_name_H|h|8}}.
 
*
 
*intervening text
 
*
 
*{{note label|reference_name_A|a|1}}Text of note for ref a.
 
*{{note label|reference_name_B|b|2}}Text of note for ref b.
 
*{{note label|reference_name_C|c|3|ABCDE}}Text of note for ref c.
 
*{{note label|reference_name_D|d|4|FGHIJ}}Text of note for ref d.
 
*{{note label|reference_name_E|e|none}}Text of note for ref e.
 
*{{note label|reference_name_F|f}}Text of note for ref f.
 
*{{note label|reference_name_G|g||{{note label|reference_name_H|h|8|Text of note for refs g and h (with extended highlighting).}}}}
 
</pre>
 
  
This would produce:
+
{{reflist}}
<div style="margin: 1em; padding: 1em; border:1px solid #999">
 
Article text{{ref label|reference_name_A|a|1}} more text{{ref label|reference_name_G|g|}} more text {{ref label|reference_name_B|b|2}} more text {{ref label|reference_name_C|c|3}} more text {{ref label|reference name_D|d|4}} more text {{ref label|reference name_E|e|none}} more text {{ref label|reference name_F|f|}} more text {{ref label|reference_name_H|h|8}}.
 
*
 
*intervening text
 
*
 
*{{note label|reference_name_A|a|1}}Text of note for ref a.
 
*{{note label|reference_name_B|b|2}}Text of note for ref b.
 
*{{note label|reference_name_C|c|3|ABCDE}}Text of note for ref c.
 
*{{note label|reference_name_D|d|4|FGHIJ}}Text of note for ref d.
 
*{{note label|reference_name_E|e|none}}Text of note for ref e.
 
*{{note label|reference_name_F|f}}Text of note for ref f.
 
*{{note label|reference_name_G|g||{{note label|reference_name_H|h|8|Text of note for refs g and h (with extended highlighting).}}}}
 
</div>
 
#Note that ref label produces a superscripted link with square brackets.
 
#The note for ref e has a "^" character as its backlink, because parameter 3 was specified as "none".
 
#The notes for refs f  and g do not have a clickable backlink, because parameter 3 was not specified.
 
  
Notice that, because the notes for refs g and h above use the same text, note h was made a part of the text passed as a final parameter to note g in order for the extended highlighting to cover both notes.
+
{{refbegin}}
 +
* general reference 1
 +
* general reference 2
 +
{{refend}}
 +
</pre>
 +
This combines both general references with in-article footnoted references.
  
=== Combining Ref family templates with the alternative referencing style ===
 
  
An example combining the use of Ref-family templates with the alternative referencing style might be something like
+
== Multiple columns ==
 +
Using <tt><nowiki>{{reflist|2}}</nowiki></tt> will create a two-column reference list, and <tt><nowiki>{{reflist|3}}</nowiki></tt> will create a three-column list.
  
<pre style="border:1; background:white; margin: 0; padding:0; line-height: 130%; word-wrap: break-word;
+
Using <tt><nowiki>{{reflist|colwidth=30em}}</nowiki></tt> will allow the browser to automatically choose the number of columns based on the width of the web browser. Choose a column width that's appropriate for the average width of the references on the page.
white-space: -moz-pre-wrap;
 
white-space:  -o-pre-wrap;
 
white-space:    -pre-wrap;
 
white-space:      pre-wrap">
 
Yammer yammer yammer.<ref name=smith2000>Smith wrote the definitive book on yammering.{{ref|Smith2000|Smith 2000}}
 
</ref>Yammer yammer yammer.<ref name=smith2000/>
 
...
 
==References==
 
<References/>
 
...
 
  
==Third party tool==
+
'''Note''': Multiple columns may not render properly in all browsers, as there are compatibility issues.  Due to this please refrain from using columns, its listed here in the doc for the sake of comprehensiveness and possible future broad use.
A third-party tool to translate articles using the templates described on this page into the Cite.php system is available.
+
<includeonly>
 +
[[Category:Templates]]
 +
</includeonly>

Latest revision as of 21:58, 7 March 2011

Use this template to create a footnote-style reference list in an article. The advantage to doing this using the Ref tag is that the wiki will take care of numbering and managing the references list, editors will not need to renumber an entire references list just to add one footnote mid-article.


Four options for usage

Option 1 (only specific/unique references)

== Content ==

Lorem ipsum.<ref>season, episode, etc.</ref>

Lorem ipsum dolor sit amet.<ref>season, episode, etc.</ref>

== References ==

{{reflist}}

This will create an uniquely numbered footnote at the end of each sentence, which will be a working link to the references list at the end of the article. The references themselves can also be links to other pages on the wiki, or even external pages.


Option 2 (repeat references)

== Content ==

Lorum ipsum.<ref>season, episode, etc.</ref>

Lorum ipsum dolor sit amet.<ref name="five01">season, episode, etc.</ref>

Lorum ipsum.<ref name"five01" />

== References ==

{{reflist}}

This will make numbered footnotes at the end of each sentence, but the number for the second and third footnotes would be the same since they refer to the same source material. The advantage of doing this is less typing and therefore smaller page file size, especially when the reference is itself a link. Note that reference name cannot be just an integer, ie. 501, it must start with an alphabetical character.


Option 3 (only general references)

== Content ==

Lorem ipsum.

Lorem ipsum dolor sit amet.

== References ==

{{refbegin}}
* general reference 1
* general reference 2
{{refend}}

This makes a list of references at the end of the article, without any footnotes citing the references to specific text in the article.


Option 4 (both specific and general references)

== Content ==

Lorem ipsum.<ref>season, episode, etc.</ref>

Lorem ipsum dolor sit amet.<ref>season, episode, etc.</ref>

Lorem ipsum.

Lorem ipsum dolor sit amet.

== References ==

{{reflist}}

{{refbegin}}
* general reference 1
* general reference 2
{{refend}}

This combines both general references with in-article footnoted references.


Multiple columns

Using {{reflist|2}} will create a two-column reference list, and {{reflist|3}} will create a three-column list.

Using {{reflist|colwidth=30em}} will allow the browser to automatically choose the number of columns based on the width of the web browser. Choose a column width that's appropriate for the average width of the references on the page.

Note: Multiple columns may not render properly in all browsers, as there are compatibility issues. Due to this please refrain from using columns, its listed here in the doc for the sake of comprehensiveness and possible future broad use.