Added tests for footnotes and refactored a bit.

* Now footnotes will be displayed after all paragraphs in an entry are displayed.
* I also changed the top level div to be an 'entry', because that's what it'll
correspond to on the site.
* The code is a little nasty for working out the footnotes. A little refactoring
will probably be in order once a good way occurs to me.