posts - 81, comments - 259, trackbacks - 0

Wednesday, September 5, 2012

BibTex Citation Management in MediaWiki

Lately I have been setting up a local MediaWiki installation to organize and document my research (see previous posts which relate to installing MediaWiki on Windows). An essential feature is of course documentation, and nise presents a nice solution by combining two extensions, Biblio and Bibtex.

This solution allows you to use the BibTex citations from a manager such as Mendeley or JabRef in both the MediaWiki citations and LaTex citations.

I integrated the two similarly to how nise has, but with a modification on matching Bibtex entries, using a regular expression instead of a string match.

  1. Install Biblio and Bibtex extensions
  2. Open Biblio.php and location the function render_biblio
  3. Define the following within the function (just under the two global's works)

     

    $bibtexx = new BibTex();

  4. Find "$text = $this->get($ref, 'text');" further down in the function and add the following just below it.

     

    if(preg_match("/@[a-zA-Z]+/", $text, $matches)){
    $bibtexx->BibTex($text);
    $text = $bibtexx->html();
    }

  5. The example by nise will now work as intended

     

    #localref local reference
    #[[Literature]]
    #somebook @book{Alexander1979,
        Author = {Christopher Alexander},
        Publisher = {Oxford University Press},
        Title = {The Timeless Way of Building},
        Year = {1979}}
    #someusualbook MySelf. "Me Myself and I". Self.
    #x ...

The difference with what was originally done is the Regular Expression match. Since a BibTex entry starts with @type, we test for @[someword].

 

 

 

 

posted @ Wednesday, September 5, 2012 10:21 AM | Feedback (1) |

Powered by:
Powered By Subtext Powered By ASP.NET