Move the macro definitions into a separate file
Replace all the level handling code with some generic code
Added two macros "block_macro" and "inline_macro" to reduce code duplication
Added (preliminary) templates for images, prodnote, sub/sup and linenum

These need to be filled in once we have the tests.
Lines and linegroups do not need a space after them
Factor out the brl:class attribute selector