Template:Reflist

From Len'en Wiki
Jump to navigation Jump to search
Documentation icon Template documentation[view] [edit] [history] [purge]

{{Reflist}} is a citation template that provides formatting and organizational features for footnotes at the bottom of a page. It encapsulates the <references /> tag used by the cite MediaWiki extension to show the list of references as defined by <ref> tags. It adds support for sizing the column width, groups and list-defined references. This was originally from Wikipedia.

Specifically, {{Reflist}} is used to list citations, where it helps to verify that the information given is supported by reliable sources.

Usage

{{Reflist}} usually needs to be placed at the bottom of a page, with a h2 header above it named "References". The usage for this is mostly for citations. Note that this template is not used to list notes: that is taken care of with {{Notelist}}.

Note that it is preferable to use {{Ref}} as the footnote marker rather than a typical <ref> tag. This allows your citation to appear within the Reflist template in an efficient way.

The following text shows how it would be typically written:
Lorem ipsum.{{ref|Citation stuff}} Lorem ipsum dolor sit amet.<ref>Citation stuff</ref>

==References==
{{Reflist}}
And as such, it would be rendered as:

Lorem ipsum.[1] Lorem ipsum dolor sit amet.[2]

References

  1. Citation stuff
  2. Citation stuff

Parameters

You can add parameters, but they are optional; if none are supplied, a single-column list will be generated if there are fewer than 10 references in the list. If more than 10 references appear, it will use columns of 30em wide depending on the device.

Optional parameters are:

  • Unnamed parameter (must be the first one if used): the minimum width for each column of references, typically in ems. Syntax (for example) |30em with no space (i.e. not |30 em). See § Columns below.
  • |refs=: used with list-defined references. See § List-defined references below.
  • |group=: identifies by name the subset of references to be rendered; the value should correspond to that used inline, e.g., {{Reflist|group=groupname}} renders all references with groupname as the group name (<ref group=groupname>). Wikipedia has five pre-defined group names that style the list differently, but the Len'en Wiki would only need three at most. See § Grouped references below.
  • |liststyle=: specifies the style used when the reference list is rendered. The default is a numerical list. When set, it will override the style set by the |group= parameter, without affecting group functionality. See § Predefined groups and list styles below.

Columns

{{Reflist|30em}} (for example) instructs the browser to create as many columns as possible (of width at least 30 em, in this example) given the width of the display window. There must not be a space between the number and the unit.

Usually, it is not required to indicate the column width as it is done automatically. However, assuming you have decided to use {{Reflist|20em}}, then the template would be rendered as:

Lorem ipsum.[1] Lorem ipsum.[2] Lorem ipsum.[3] Lorem ipsum.[4] Lorem ipsum.[5] Lorem ipsum.[6] Lorem ipsum.[7] Lorem ipsum.[8] Lorem ipsum.[9] Lorem ipsum.[10] Lorem ipsum.[11]

References

  1. Citation stuff
  2. Citation stuff
  3. Citation stuff
  4. Citation stuff
  5. Citation stuff
  6. Citation stuff
  7. Citation stuff
  8. Citation stuff
  9. Citation stuff
  10. Citation stuff
  11. Citation stuff
  • The syntax {{Reflist|2}} (for example), which specifies two columns of equal width regardless of the available display width, is deprecated (and is disabled for mobile view). When you use 1, the template gives you a single column while 2 will pretend you specified 30em. When using higher column counts, it will pretend you specified 25em.
  • Browser support: Internet Explorer 10+, Microsoft Edge, Firefox 2+, Chrome 4+, Safari 3.1+, Opera 11.1+.

List-defined references

Note: Not usually needed.

A list of references may be defined within {{Reflist}} using the |refs= parameter, just like including named <ref name="...">...</ref> elements inside the <references>...</references> container.

Example

Markup:
This is reference 1.<ref name="refname1" />
This is reference 2.<ref name="refname2" />

==References==
{{Reflist|refs=
<ref name="refname1">content1</ref>
<ref name="refname2">content2</ref>
}}
Rendered as:

This is reference 1.[1]

This is reference 2.[2]

References

  1. content1
  2. content2

Grouped references

References can be grouped into separate sections (for explanatory notes, table references, etc.) via group=:

<ref group=groupname>

where groupname is (for example) games or sources. The group name need not be enclosed in quotes; this differs from the footnote marker where quotes are required if the group name includes a space.

Each group used in the article must have a matching reference list:

{{Reflist|group=groupname}}

Predefined groups and list styles

This should be use subtly and with good reason. There are three predefined group names that automatically set the labels in the footnote markers and the reference list to other styles (e.g. [1]). Reference lists are by default numbered lists. By using the |liststyle= parameter, you can control how the list is rendered. For example, using |liststyle=lower-roman will result in references being labelled with roman numerals instead of decimal numbers. The parameter accepts any valid CSS value defined for list-style-type.

You could instead use the |group= parameter to state a preferred list style. Thus, setting {{Reflist|group=lower-roman}} will set the group to lower-roman and also style the reference list with roman numbers. The matching footnote marker can be formed by <ref group=roman>...</ref>. If you use both parameters, then |liststyle= will override the list style stated in |group=.

This is made easier by a series of templates to set the group/label styles for the footnote marker and the reference list:

Group type Sample labels
none 1 2 3 4 5 6 7 8 9 10
lower-alpha a b c d e f g h i j
lower-roman i ii iii iv v vi vii viii ix x

Wikipedia has up to five of these, plus it's a bit more complicated, but for the Len'en Wiki, three simple groups listed above are more than enough.

Take note that it is possible to use |liststyle= so that the labels for the footnote marker and the reference list marker differ. This should be used with care as it can be confusing to readers. For example:

Markup:
<ref group=note>Reference</ref>

{{Reflist|group=note|liststyle=lower-alpha}}
Renders as:

[note 1]

  1. Reference

Technical details

Font size

The font size should reduce to 83% for most browsers, but may appear to show at 100% for Internet Explorer and possibly other browsers.

Interaction with images

In the unusual case of an image being placed to the left of a reference list, layout problems may occur on some browsers. This can be prevented by using the columns feature.

Browser support for columns

Multiple columns are generated by using CSS3, which is still in development; thus only browsers that properly support the multi-column property will show multiple columns with {{Reflist}}, such as Firefox, Chrome and Internet Explorer.

Widows and orphans

The use of columns can result in widows and orphans, where a citation at the bottom of a column may be split to the top of the next column. MediaWiki:Common.css includes CSS rules to prevent list items from breaking between columns. Widows may still show in extreme circumstances.

Supporting CSS

{{Reflist}} uses a CSS rule in MediaWiki:Common.css to set the font size:

  • div.reflist { font-size: 83%; }

The following class is assigned by the template when column width is set:

  • .references-column-width

Customizing the view

By editing your CSS, the personal appearance of the reference list can be customized. From Preferences, select the Appearance tab, then on the selected skin select Custom CSS. After editing and saving, follow the instructions at the top of the page to purge. See Wikipedia:Skin#Customisation (advanced users) for more help.

Font size

Reference lists defaults to 90% standard font size. To change it, add:

ol.references,
div.reflist,
div.refbegin {
  font-size: 83%;
}

Change 83% to the desired size.

Columns

To disable columns, add:

.references-column-width {
  -moz-column-width: auto !important;
  -webkit-column-width: auto !important;
  column-width: auto !important;
}
Column dividers

To add dividers (rules) between columns, add:

.references-column-width {
  -moz-column-rule: 1px solid #aaa;
  -webkit-column-rule: 1px solid #aaa;
  column-rule: 1px solid #aaa;
}

You can alter the appearance of the dividers by changing the values.

See also