Support macros

This adds three directives:

- @macro (name): Starts recording a macro identified by 'name'
- @endmacro: Stops recording a macro
- @do (name, kwargs): "Execute" the macro identified by 'name' by replacing the
  directive by the recorded macro contents, using kwargs to format the lines