Difference between revisions of "Template:Reflist/doc"

From Captain of Industry Wiki
Jump to: navigation, search
(Creation)
 
(Creation)
 
Line 1: Line 1:
==Description==
This [[Wikipedia:Citation templates|citation template]] provides formatting and organizational features for [[Wikipedia:Help:Footnotes|footnotes]]. It encapsulates the &lt;references&gt; tag used by the <code>cite.php</code> MediaWiki extension to show the list of references as defined by &lt;ref&gt; tags. It adds support for sizing the column width, groups and list-defined references.
Use this template to create a reference list in small font for an article. Note that there is no consensus that small font size should always be used for all references; when normal-sized font is more appropriate on an article, use <code><nowiki><references /></nowiki></code> instead.<ref>I am a reference</ref>


==Dependencies==
==Parameters==
===CSS used===
There are no ''required'' parameters; if none are supplied, a single-column list will be generated if there are fewer than 10 references in the list. If you have more than 10 references, it will use columns of 30em wide if your device allows this.
<pre>
.references-small { font-size: 90%; }
</pre>


==Syntax==
Optional parameters are:
Type <code>{{t|reflist|...}}</code> where you would normally type <code><nowiki><references/></nowiki></code>. If used with no parameters, it will produce a reference list with a single column.
* Unnamed parameter (must be the first one if used): the minimum width for each column of references, typically in [[Wikipedia:em (typography)#CSS|em]]s. Syntax (for example) {{t|reflist|30em}} with no space (i.e. not {{t|reflist|30 em}}). Note that this replaces '''colwidth'''—see Obsolete parameters section.
* '''refs''': used with list-defined references.
* '''group''': identifies by name the subset of references to be rendered; the value should correspond to that used inline, e.g., {{t|Reflist|2=group=groupname}} renders all references with ''groupname'' as the group name. There are five pre-defined group names that style the list differently. See [[#Grouped references|§ Grouped references]] below.
* '''liststyle''': specifies the style used when the reference list is rendered. The default is a numbered list. When set, it will override the style set by the <code>group</code> parameter, without affecting group functionality. See [[#List styles|§ List styles]] below.


=== Multiple columns ===
==Usage==
Using <code><nowiki>{{reflist|2}}</nowiki></code> will create a two-column reference list, and <code><nowiki>{{reflist|3}}</nowiki></code> will create a three-column list.  Three-column lists are inaccessible to users with smaller/laptop monitors and should be avoided.
{{markup|title=Using only footnote-style references
|<nowiki>Lorem ipsum.<ref>Source name, access date, etc.</ref>


Using <code><nowiki>{{reflist|colwidth=30em}}</nowiki></code> 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.
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>


Note: multiple columns currently render properly only in Mozilla Firefox and other Gecko-based browsers and Safari 3, though the feature is included in CSS3 so it should work for a larger number of browsers in the future.
==References==
{{Reflist}}</nowiki>
|Lorem ipsum.<ref>Source name, access date, etc.</ref>
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>


==Sample output==
{{fake heading|sub=3|References}}
<code><nowiki>{{reflist}}</nowiki></code> gives...
{{Reflist}}
}}


{{reflist}}
===Columns===
{{t|Reflist|30em}} (for example) instructs the browser to create as many columns as possible (of width at least 30&nbsp;[[Wikipedia:Em (typography)|em]], in this example) given the width of the display window. ([http://www.w3.org/TR/CSS21/syndata.html#length-units Units supported are em, ex, in, cm, mm, pt, pc, px], but em is almost always used.) There must not be a space between the number and the unit. Percent is not supported.


====Example====
{{markup|title=15em wide columns (vary width of display window to see change in number of columns)
|<nowiki>Lorem ipsum.<ref>Source name, access date, etc.</ref>
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>


==See also==
==References==
*[[wikipedia:Template:Reflist|Templates:Reflist]] on Wikipedia.<includeonly>
{{Reflist|15em}}</nowiki>
[[Category:General wiki templates]]
|Lorem ipsum.<ref>Source name, access date, etc.</ref>
</includeonly><noinclude>
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>
[[Category:Template documentation]]
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>
</noinclude>
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>
 
{{fake heading|sub=3|References}}
{{Reflist|15em}}<!-- note 15em used here for illustration purposes because larger value won't columnize in the "renders as" part on many screens -->
}}
 
The syntax {{tlx|Reflist|2}} (for example), which specifies two columns of equal width ''regardless of the available display width'', is deprecated. 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.
 
==Technical details==
===Font size===
The font size should reduce to 90% for most browsers, but may appear to show at 100% for Internet Explorer and possibly other browsers.<ref group="general" name="fontsize" /> As of December 21, 2010, the standard &lt;references&gt; tag has the same font styling. The smaller font may be disabled through.
 
===Browser support for columns===
Multiple columns are generated by using [[Wikipedia:Cascading Style Sheets|CSS3]], which is still in development; thus only browsers that properly support the multi-column property will show multiple columns with {{tl|Reflist}}.
 
These browsers '''support''' CSS3 columns:
* [[Wikipedia:Gecko (software)|Gecko]]-based browsers such as [[Wikipedia:Mozilla Firefox]]
* [[Wikipedia:WebKit]]-based browsers such as [[Wikipedia:Safari (web browser)|Safari]] and [[Wikipedia:Google Chrome]]
* [[Wikipedia:Opera (web browser)|Opera]] from version 11.10 onward
* [[Wikipedia:Internet Explorer]] from version 10 onward
 
These browsers do '''not support''' CSS3 columns:
* Microsoft [[Wikipedia:MSHTML]]-based browsers including Internet Explorer up to version 9<ref group="general" name="msdn" />
* [[Wikipedia:Opera (web browser)|Opera]] through to version 11
 
==Obsolete parameters==
These parameters are no longer in use:
* '''colwidth''': Same as specifying a column-width for the first unnamed parameter. Replaced by width as unnamed first parameter.
 
==Limitations==
Do not use {{tl|Reflist}} or other templates or modules that use &lt;:references&gt; in numbered or unnumbered lists if the list is inside an [[Wikipedia:Span and div|HTML div tag]].
 
<includeonly>
[[Category:Footnote templates]]
[[Category:Reference list templates]]
</includeonly>

Latest revision as of 10:08, 22 January 2022

This citation template provides formatting and organizational features for footnotes. It encapsulates the <references> tag used by the cite.php 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.

Parameters

There are no required parameters; if none are supplied, a single-column list will be generated if there are fewer than 10 references in the list. If you have more than 10 references, it will use columns of 30em wide if your device allows this.

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) {{reflist|30em}} with no space (i.e. not {{reflist|30 em}}). Note that this replaces colwidth—see Obsolete parameters section.
  • refs: used with list-defined references.
  • 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. There are five pre-defined group names that style the list differently. See § below.
  • liststyle: specifies the style used when the reference list is rendered. The default is a numbered list. When set, it will override the style set by the group parameter, without affecting group functionality. See § below.

Usage

Using only footnote-style references
Markup Renders as
Lorem ipsum.<ref>Source name, access date, etc.</ref>

Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>

==References==
{{Reflist}}

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

References
  1. Source name, access date, etc.
  2. Source name, access date, etc.

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. (Units supported are em, ex, in, cm, mm, pt, pc, px, but em is almost always used.) There must not be a space between the number and the unit. Percent is not supported.

Example

15em wide columns (vary width of display window to see change in number of columns)
Markup Renders as
Lorem ipsum.<ref>Source name, access date, etc.</ref>
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>
Lorem ipsum dolor sit amet.<ref>Source name, access date, etc.</ref>

==References==
{{Reflist|15em}}

Lorem ipsum.[1] Lorem ipsum dolor sit amet.[2] Lorem ipsum dolor sit amet.[3] Lorem ipsum dolor sit amet.[4] Lorem ipsum dolor sit amet.[5]

References
  1. Source name, access date, etc.
  2. Source name, access date, etc.
  3. Source name, access date, etc.
  4. Source name, access date, etc.
  5. Source name, access date, etc.

The syntax {{Reflist|2}} (for example), which specifies two columns of equal width regardless of the available display width, is deprecated. 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.

Technical details

Font size

The font size should reduce to 90% for most browsers, but may appear to show at 100% for Internet Explorer and possibly other browsers.[general 1] As of December 21, 2010, the standard <references> tag has the same font styling. The smaller font may be disabled through.

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}}.

These browsers support CSS3 columns:

These browsers do not support CSS3 columns:

Obsolete parameters

These parameters are no longer in use:

  • colwidth: Same as specifying a column-width for the first unnamed parameter. Replaced by width as unnamed first parameter.

Limitations

Do not use {{Reflist}} or other templates or modules that use <:references> in numbered or unnumbered lists if the list is inside an HTML div tag.



Cite error: <ref> tags exist for a group named "general", but no corresponding <references group="general"/> tag was found