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.

Best regards,
s-m