Use regular expressions for expanding templates

Previously the `Data elements had leading and trailing whitespace
and additional text ("openmirage :: $TITLE$") which means we need
something stronger than List.assoc.
Merge pull request #16 from djs55/fix-template-replacement

Use regular expressions for expanding templates