BUG: Fix invalid code with source-file-comments, fixes #1487

The parser could sometimes generate invalid code if the source-file-comments were enabled, this moves the comments outside the html-tag to circumvent these problems, see #1487 for details, this includes a change to the test-case for the template comments...

Best regards,
s-m