Extension:Bibtexio

Motivation
This extension solved these issues for me:
 * Simple and quick to install with minimal configuration.
 * bibtex format Bibliography page
 * IEEE style in-text citation.
 * IEEE style bottom-of-page references.
 * I was unable to get the very nice-looking Extension:Bibwiki working in time for my grad work. Bibwiki conflicted with the File Indexer extension, which I use to keep track of some papers.

History
This extension was adapted from Extension:Bibliography by Thomas Pfeiffer, and then re-adapted by NikosFrangakis Extension_talk:Bibliography. Then re-adapted for my needs.

This extension is used on our internal department wiki. I'm re-publishing this without warranty. I don't guarantee that this php is secure in any way, since I'm not a PHP coder.

This code is a ugly because I code only out of necessity to meet my grad work needs. It could use your help. See To Do (or not To Do).

What can this extension do?

 * In-text IEEE format citations using brackets, like this [1]
 * In-text citations are auto-numbered. The first reference [1] then the second [2] and so on.
 * Optionally print a list of auto-numbered references at the bottom of the page, in IEEE format.
 * Bibliography information is stored on the Bibliography page in bibtex format.
 * All fourteen (14) bibtex formats are supported.
 * Automatic checking for fields required by bibtex to make sure you fill them in.
 * Bibtex url field automatically converted to clickable link.
 * Bibtex wikilink filed automatically converted to local file/image link - I link to uploaded papers in pdf format.
 * All references are keyed on the Bibtex citation key. This allows you to re-use a reference over an over just by continuing to reference its citation key.
 * All entries that have a value, even new ones you create for your own needs, will print in the Bibliography page.
 * Add automatically-generated fields by editing $IP/extensions/bibliography/bibtex_fields.php

Quick Usage

 * 1) Unpack the file in the extensions directory. Add this to the bottom of your 'localsettings.php file.
 * 2) Create a Bibliography page and put this at the bottom.
 * 3) Go to the page where you want the references. Put this at the top:
 * 4) Put this at the bottom:
 * 5) Make some references on the page like this. Replace CitationKey with your bibtex-style citation key (no spaces). Don't duplicate keys, as there is no checking for duplicated citation keys. 
 * 6) Save page and click to create a new bibtex entry.

Long Usage

 * 1) Ensure bibliography is imported at the top of the page, before any references are made.
 * 2) Create an in-text reference on the page like this .
 * 3) Save the page.
 * 4) Since the reference you created doesn't exist, it will appear in red like this, [1].
 * 5) Mouseover the red [1] and the popup will offer to let you create a new bibtex entry. [[Image:Reference-popup.png|center]]
 * 6) Also, you can have the references print at the bottom of the page. Just put this at the bottom of the page.
 * 7) If you add the bibprint command and then save the page, you will see this at the bottom of the page [[Image:Bibprint-bibtex.png]]
 * 8) Click on the type of bibtex reference you want in the mouseover or from the list at the bottom of the page. They will take you to the same place. For this example, I will click book. You will then see this automatically... [[Image:Entering-bibtex-info.png]]
 * 9) To demonstrate the automatic required bibtex field checking, I will simply click save page. You will see this: [[Image:Bibtex-auto-field-checking.png]]
 * 10) To continue the example, I will enter the required information and three optional pieces of information like this. This will show you that the green boxes asking for required information don't appear in the source when you edit a page, and that they disappear when you fill them in. This will also show you that although the page source shows all bibtex fields, only the filled in ones (optional/ignored fields) are printed on the Bibliography page. Finally, the url and wikilink automatically become clickable. [[Image:Entering-bibtex.png]]
 * 11) Then save page and you will see this. url will be an external URL, and wikilink links to a local server-side file. I use this to link journal articles in pdf format the we have written. [[Image:Bibtexio-bibtex.png]]
 * 12) Very important, you must add this line to the bottom of the bibliography page:
 * 13) Finally, navigate back to your original page where you made the reference. The reference number will turn from red [1] to blue [1] . Also, the mouseover will contain quick information about the the reference, and the bottom of the page will have IEEE-style reference. Both will are automatically hyperlinked to the bibtex entry on the Bibliography page. [[Image:Bibtexio-final.png]]
 * 14) One last option is to create a BibliographyPrint page to print all of your references in IEEE style all on one page. Add only one thing to the page:

Download instructions
Download and unzip in your $IP/extensions directory. bibliography.tar.gz
 * Warning - if you put it in any directory other than $IP/extensions/bibliography you will break this extension. It has some ugly hacks in it that need to be rooted out.

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

Make sure the $IP/extensions/bibliography/bibliography.php directory is writable, because there is a hack using a tmp file in this directory (inherited with the codebase).

To Do (or not To Do)

 * When   is at the top of the page, line breaks (hitting enter) are sometimes not respected, i.e. text on multiple lines gets put on one line. Headings are always respected. My solution is in some places just to use html returns i.e.
 * References that are not completely filled out may not format properly.
 * There is some issue with checking commas followed by periods in some situations (details of the IEEE format).
 * The bibliography uses an tmp file placed in the $IP/extensions/bibliography directory. Shouldn't need a tmp file.
 * Not all of the optional bibtex fields are made use of as they should, because...
 * I haven't implemented a super-duper complete IEEE-style reference formatting. It's just barely good enough, and the formatting code needs work. As long as everything is filled out, they should look ok. I expect true IEEE-formatting to require more extensive logic than I've done.
 * Citation keys are not checked for duplicates.
 * The Bibliography page has a tendency to become one giant, long page and is not managed in any way, not even alphabetically. A tool here would be useful. It may be better to split citation keys into their own pages.
 * There is a tendency to delete the    is a little kludgy. It would be nicer if they were automated some how.
 * It would be nice if the formatting style (ACM, IEEE) were a selectable option.