MediaWiki extension: Cite (extended)

InfoDabble > Tech Notes > MediaWiki > MediaWiki extension: Cite (extended)
Jump to: navigation, search
This project is still under development.
This is a MediaWiki Extension
Cite (extended)

Release status: beta

Type: Parser extension
Description: Add footnotes in a document
Author: Ævar Arnfjörð Bjarmason, Eric Hartwell
MediaWiki: 1.6
Download: Cite.php

Cite.i18n.php

Enhancing the Cite.php citation manager

While Cite.php is used in many sites (including Wikipedia), it has its share of problems.

  • Because it calls the MediaWiki parser, which is not truly recursive, there are weird results when the <ref> tag is used in included pages or templates.
  • There is no clean way to refererence different pages within the same document
  • It would be nice to specify the full reference inside the <nowiki><references></nowiki> tag instead of inline in the text.

Extending the Extension

Ideally, citations should be collected by the MediaWiki parser, exactly the same way that the table of contents is built for each page. Unfortunately, the TOC code is intimately tied into the parser code, and not easily extended. The more practical approach is to build on the current extension code.

The citation manager should accumulate references until it reaches the end of the page (using a message hook - for the top level page). It should record each <nowiki><ref></nowiki> and <nowiki><references></nowiki> tag, and output a unique marker into the temporary page.

Only when the page is completely built, with all the wikitext and especially the templates expanded, should we go back and built the citation list. Any references (<nowiki><ref></nowiki> tag) that didn't make it into the final page should be dropped.

At that point it should sort the list and identify references to different parts of the same document. The sources should be formatted with a main entry for the document, then a separate sub-entry for each part:

  1. Main document 1
    1. page 100
    2. section 3.3
  2. Document 2

The sources could be shown in the order referenced, or optionally sorted by raw text and page (or author, title, publication, date?). If a list of sources is included between &lt;references&gt; and &lt;/references&gt; tags, then those sources should be used first, in the order specified, even if there are no actual references in the page.

i.e. either <nowiki><references /></nowiki> or <nowiki><references></nowiki>.