cleanup templates, reoptimize macro subs, fixes & tests

- use function for inserting title div in html5 templates
- use string interpolation instead of concat in template functions
- clean up macro substitution optimizations
- fix link macro embedded in footnote
- allow entities to be escaped
- fix invalid attribute parsing if value is quoted value is empty
- don't override caption if set to empty string
- fix invalid reference to regex constant
- add idseparator to customize separator used to generate section ids
- recover if separator is missing from first cell of psv table
- add support for 'd' cell style (for default, or normal)
- add tests for forward and backward xref references
Merge pull request #138 from mojavelinux/cleanups-small-fixes

Cleanup templates, reoptimize macro subs, fixes & tests