قالب:Listref/reflist
هذا القالب يستخدم أنماط القوالب: |
This template creates in-text citations and a reference list for use in list articles as a supplement to the standard footnote system. It is intended for use only for references used a large number of times. The template is styled to render in-text citations and the reference list like the <ref>
tags and {{reflist}} template used by the footnote system.
Differences:
- There is no backlink from the citation in the reference list, by design.
- The in-text citation uses a standard HTML link without an id, by design. Other templates create an HTML id, which is only allowed to be defined once, thus multiple uses of the same in-text citation results in invalid HTML
- The in-text citation link and the anchor in the reference list are created manually.
Likenesses:
- In-text citations use the same style.
- The reference list uses the same marking and font size.
- The citation in the reference list is highlighted when the in-text citation is followed.
- The reference list can be formatted with columns like {{reflist}}.
This template is compatible with User:Blue-Haired Lawyer/Footnote popups.
The problem
List articles often use a single named reference a large number of times. Each use creates a backlink in the reference list entry and eventually the backlinks become ugly and useless. For example:
Backlinks are defined in MediaWiki:Cite references link many format backlink labels. Backlinks were originally only a—z but over time have been increased to a—azz allowing for 1377 backlinks.
Examples:
Templates such as {{ref}} create an HTML id. When reused, the same id is defined multiple times resulting in invalid HTML.
In-text citation
The in-text citation is a link created with an unnamed parameter that defines the link id. If undefined, it defaults to a.
Examples:
Although any characters can be used, only these styles will link to citations in the reference list:
- lower-alpha
- upper-alpha
- lower-roman
- upper-roman
- lower-greek
- decimal
To include a page number use |p=
Reference list
The citations are defined in and the reference list is displayed with {{listref/reflist}}
. There are two named parameters for up to nine citations:
|id1=
through|id9=
matches the link id set with {{listref}}.|ref1=
through|ref9=
defines the full citation.
{{Listref/reflist}}
supports style parameters similar to {{reflist}}:
- Columns: Using
{{listref/reflist|2}}
will create a two-column reference list,{{listref/reflist|3}}
will create a three-column list, and{{listref/reflist|30em}}
will automatically choose the number of columns based on the width of the web browser. You should set this to match the columns parameter in {{reflist}}. - List style: The reference list is styled as lower-alpha by default. It can be changed with
|liststyle=
to:- upper-alpha
- lower-roman
- upper-roman
- lower-greek
- decimal
- The style must match the in-text link id style.
{{listref/reflist |id1=a |ref1=Reference a |id2=b |ref2=Reference b }}
Citations in the reference list must be in the proper order for the ordered list to work properly.
Freestyle
You can use any text for the label by setting |liststyle=square
. The reference list will show as an unordered list and the label will show in the reference list at the beginning of each entry enclosed by brackets.
Examples
* The brontosaurus is thin at one end.{{listref}} * Then it becomes much thicker in the middle.{{listref}} * The Norwegian Blue Parrot will not move if its feet are nailed to the perch.{{listref|b}} * Its metabolic processes are a matter of interest only to historians.{{listref|b}} {{listref/reflist| |id1=a |ref1={{cite book |last=Elk |first=Anne |title=[[Anne Elk's Theory on Brontosauruses]] |date=November 16, 1972}} |id2=b |ref2={{cite book |last=Praline |first=Eric |title=[[Dead Parrot sketch]] |date=December 7, 1969}} }}
- The brontosaurus is thin at one end.[أ]
- Then it becomes much thicker in the middle.[أ]
- The Norwegian Blue Parrot will not move if its feet are nailed to the perch.[b]
- Its metabolic processes are a matter of interest only to historians.[b]
- Elk, Anne (November 16, 1972). Anne Elk's Theory on Brontosauruses.
- Praline, Eric (December 7, 1969). Dead Parrot sketch.
* The brontosaurus is thin at one end.{{listref|i}} * Then it becomes much thicker in the middle.{{listref|i}} * The Norwegian Blue Parrot will not move if its feet are nailed to the perch.{{listref|ii}} * Its metabolic processes are a matter of interest only to historians.{{listref|ii}} {{listref/reflist|liststyle=lower-roman |id1=i |ref1={{cite book |last=Elk |first=Anne |title=[[Anne Elk's Theory on Brontosauruses]] |date=November 16, 1972}} |id2=ii |ref2={{cite book |last=Praline |first=Eric |title=[[Dead Parrot sketch]] |date=December 7, 1969}} }}
- The brontosaurus is thin at one end.[i]
- Then it becomes much thicker in the middle.[i]
- The Norwegian Blue Parrot will not move if its feet are nailed to the perch.[ii]
- Its metabolic processes are a matter of interest only to historians.[ii]
- Elk, Anne (November 16, 1972). Anne Elk's Theory on Brontosauruses.
- Praline, Eric (December 7, 1969). Dead Parrot sketch.
- Elk, Anne (November 16, 1972). Anne Elk's Theory on Brontosauruses.
- Praline, Eric (December 7, 1969). Dead Parrot sketch.
Used with standard footnotes:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<ref>consectetur adipisicing elit</ref> Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<ref>sunt in culpa qui officia</ref> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. * The brontosaurus is thin at one end.{{listref}} * Then it becomes much thicker in the middle.{{listref}} * The Norwegian Blue Parrot will not move if its feet are nailed to the perch.{{listref|b}} * Its metabolic processes are a matter of interest only to historians.{{listref|b}} {{listref/reflist| |id1=a |ref1={{cite book |last=Elk |first=Anne |title=[[Anne Elk's Theory on Brontosauruses]] |date=November 16, 1972}} |id2=b |ref2={{cite book |last=Praline |first=Eric |title=[[Dead Parrot sketch]] |date=December 7, 1969}} }} {{reflist}}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.[1] Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.[2] Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
- The brontosaurus is thin at one end.[أ]
- Then it becomes much thicker in the middle.[أ]
- The Norwegian Blue Parrot will not move if its feet are nailed to the perch.[b]
- Its metabolic processes are a matter of interest only to historians.[b]
- Elk, Anne (November 16, 1972). Anne Elk's Theory on Brontosauruses.
- Praline, Eric (December 7, 1969). Dead Parrot sketch.
Freestyle labels
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<ref>consectetur adipisicing elit</ref> Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<ref>sunt in culpa qui officia</ref> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. * The brontosaurus is thin at one end.{{listref|bronto}} * Then it becomes much thicker in the middle.{{listref|bronto}} * The Norwegian Blue Parrot will not move if its feet are nailed to the perch.{{listref|parrot}} * Its metabolic processes are a matter of interest only to historians.{{listref|parrot}} {{listref/reflist|liststyle=square |id1=bronto |ref1={{cite book |last=Elk |first=Anne |title=[[Anne Elk's Theory on Brontosauruses]] |date=November 16, 1972}} |id2=parrot |ref2={{cite book |last=Praline |first=Eric |title=[[Dead Parrot sketch]] |date=December 7, 1969}} }} {{reflist}}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.[1] Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.[2] Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
- The brontosaurus is thin at one end.[bronto]
- Then it becomes much thicker in the middle.[bronto]
- The Norwegian Blue Parrot will not move if its feet are nailed to the perch.[parrot]
- Its metabolic processes are a matter of interest only to historians.[parrot]
- [bronto] Elk, Anne (November 16, 1972). Anne Elk's Theory on Brontosauruses.
- [parrot] Praline, Eric (December 7, 1969). Dead Parrot sketch.
Troubleshooting
To show errors, add this to Special:MyPage/skin.js (current skin only) or Special:MyPage/common.js (all skins):
importScript('MediaWiki:ListrefErrors.js'); // Linkback: [[MediaWiki:ListrefErrors.js]]
This will detect and show two types of errors:
- Listref error: link to name doesn't point to any matching citation.
- The in-text cite invoked by {{listref}} does not have a matching citation defined in {{listref/reflist}}.
- Listref error: There is no link pointing to this citation.
- The citation defined in {{listref/reflist}} has no in-text cites invoked by {{listref}} that link to it.
After installing the script, errors should show in this test:
- Citation defined in {{listref/reflist}} with no in-text links.
Bug
The issue with over-backlinking has been reported as قالب:Phab Cite extension: suppress backlink. If the extension is updated, then this template should be deprecated.
See also
The above documentation is transcluded from قالب:Listref/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Subpages of this template. |