Extension:WikiCitation

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
WikiCitation

Release status: experimental

Implementation Parser function, Tag
Description Allows users to add template-based citations, notes, and automatic bibliographies, based on standard citation styles such as the Chicago Manual of Style.
Author(s) (COGDENtalk)
Latest version 0.8
MediaWiki 1.17+ (possibly earlier)
PHP 5.2.3
License GPL 2+
Download MediaWiki SVN
Parameters

$wgWCStyleSheet, $wgWCCitationStyles

Tags
<biblio>, <note>, <endnote>
Hooks used
ParserFirstCallInit

ParserClearState
ParserBeforeTidy
InlineEditorPartialAfterParse
BeforePageDisplay

Translate the WikiCitation extension if possible

Check usage and version matrix; code metrics

What can this extension do?[edit | edit source]

This extension allows MediaWiki editors to add standard citations, footnotes, and bibliographies. It takes much of the work out of formatting citations and bibliographies by hand, and ensures consistency between multiple citations to the same reference within the same article.

Currently, citations are most often provided in the form of wiki templates, which are notoriously slow, awkward, and easy to corrupt. For example, the English Wikipedia uses an underlying template called "citation/core", originally developed by the main author of this extension in early 2007. This template is one of the largest and most complicated templates on the English Wikipedia, and it is widely used. Some articles cite this template over 100 times. Wiki templates were not originally designed for such complicated and server-intensive uses, yet there is an acute need for a citation template, as attested by the current flawed template's widespread use. The old "citation/core" wiki template could have been even more complicated than it is; however, compromises in citation style were made to keep it as simple as possible. Therefore, there is a need for a built-in template, written in PHP, that can efficiently render citations of all kinds, in potentially a variety of standard citation formats such as the Chicago Manual of Style.

This extension meets that need. However, it does more than simply render citations. It provides a complete and consistent citation system that includes citations, footnotes, and bibliographies. Citations added to the running text or in footnotes will automatically be listed in the bibliography, if one is included, and the bibliography will be sorted. An editor can either include the citations in footnotes, or in parenthetical author-date annotations. An editor only needs to provide the entire citation date once per article, and may use short-form citations such as {{#cite:|last=Gonzales|date=2000}}, which this extension will match with a long-form citation from the bibliography, or from another location in the article. Depending on where the citation is placed (i.e., in the running text, in footnotes, or in the bibliography), the citation will be formatted appropriately.

A typical long-form citation looks like the following:

{{#cite:author-date
 | type=book
 | translator-first=Gérard
 | translator-dropping-particle=de
 | translator-non-dropping-particle=la
 | translator-last=Martinière
 | translator-suffix=III
 | editor1-first=Richard
 | editor1-last=Jones
 | editor2-first=Bob
 | editor2-last=Johnson
 | date=1999
 | publisher=Publisher, Co.
 | publisher-place=New York
 | title=This work has a translator and editor, but no author
}}

which (if this is a default Chicago Manual of Style citation) would render an author-date bibliography citation as follows:

Jones, Richard and Bob Johnson, eds. 1999. This work has a translator and editor, but no author. Translated by Gérard de la Martinière III. New York: Publisher, Co.

Normally, a citation such as the above would be part of a bibliography. Bibliographies may be created by using the <biblio> tag. If a <biblio> tag appears in an article, any citation on that page, either within or outside the <biblio> tag, will be incorporated in a sorted bibliography at the location of the <biblio> tag.

One need only provide the full citation date once per article for each citation. Other citations to the same reference need only provide enough data to allow a match to be made. For example, if the above citation is present in an article, a second, short-form reference to the same source may take the form of:

{{#cite:short | author-date | editor1-last=Jones | date=1999 | page=20}}

which would render a short-form citation as follows: (Jones and Johnson 1999, 20).

If the editor wishes to put citations in footnotes/endnotes, he or she may use the <note>...</note> tag, and then provide an endnote section toward the end of the article using the <endnotes>...</endnotes> tag. These tags work similarly to the "Cite/Cite.php" extension that is in widespread use in MediaWiki articles. These tags, however, are specially suited for citations. Placing a citation within <note>...</note> tags will automatically tell the software to format the citation as a footnote citation. It will ensure that the first time the citation appears in the article's footnotes, it is cited in its full form, regardless of where the full-form template appears in the article. Depending on the styling standard (e.g., Chicago Manual of Style), appearances in later footnotes will be in the short form. If the same citation appears in adjacent footnotes, the second one might, for example, be replaced by the word "Ibid."

Usage[edit | edit source]

A citation has the following Backus-Naur form (in English localization):

<citation>   ::= "{{#cite:" <data> "}}"
<data>       ::= <flags> "|" <parameters>
               | <flags>
               | <parameters>
<flags>      ::= <flag>
               | <flag> "|" <flags>
<flag>       ::= <length> "|" <type>
               | <type> "|" <length>
               | <length>
               | <type>
<length>     ::= "long" | "short"
<type>       ::= "inline" | "note" | "biblio" | "author-date"
<parameters> ::= <parameter>
               | <parameter> "|" <parameters>
<parameter>  ::= <label> <optional-whitespace> "=" <optional-whitespace> <value>

A bibliography has the following form, as an XML-style tag located at the place where the bibliography will be created:

<biblio citestyle="..." type="...">...</biblio>

where the citestyle and type attributes define the citation style (e.g. "Chicago") and type (e.g., "biblio" or "author-date"), respectively. Citations within this <biblio> tag will be sorted alphabetically. Citations defined in the body of the text, or in footnotes, will automatically be included in the bibliography.

More documentation is forthcoming.

Instructions for download and installation[edit | edit source]

The extension is working but experimental, and is subject to change. It can be downloaded from the MediaWiki SVN . Once downloaded, it should be placed in the "extensions" folder of your MediaWiki installation. There is apparently no ftp or web-accessible tarball. If you don't have svn, you're SOL.

To install WikiCitation, add the following to LocalSettings.php:

require_once("$IP/extensions/WikiCitation/WikiCitation.php");

See also[edit | edit source]