Footnotes, special sections and special lists

- implement the footnote and footnoteref macros
- add footnote template
- store the footnotes in the document references
- add a reified footnotes section to the footer
- add support for special sections, flag them as such
- add a numbered caption to appendix sections
- don't number special sections if numbered is on
- add templates for special lists (glossary, qanda and bibliography)
- support bibliography anchors
- fix extra blank lines being added in labeled lists
- tests for all that