GH-17: escape macros, quotes, and hyphens in code

Thanks to zimbatm for reporting this issue.