Extension:WikiCitation

What can this extension do?
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, 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: 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  tag. If a  tag appears in an article, any citation on that page, either within or outside the   tag, will be incorporated in a sorted bibliography at the location of the   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: 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  tag, and then provide an endnote section toward the end of the article using the   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  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
A citation has the following Backus-Naur form (in English localization):

A bibliography has the following form, as an XML-style tag located at the place where the bibliography will be created: where the style and type attributes define the citation style (e.g. "Chicago") and type (e.g., "biblio" or "author-date"). Citations within this  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.

Download instructions
Code is soon to be released.

Installation
To install this extension, add the following to LocalSettings.php: