[Zope] Standard HTML Comments

J Cameron Cooper jccooper@jcameroncooper.com
Thu, 20 Feb 2003 15:09:36 -0600


>
>
>Does anyone know why standard HTML comments are rendered in the output by
>a DTML method when it is executed? I know that using the DTML comment
>tag is a way around this problem, but for the sake of consistency I would
>like to continue to use HTML standard comments in DTML methods if
>possible. Is there something I can do to make the method ignore them? Any
>help would be appreciated. Thanks.
>  
>
HTML comments in DTML, like all other HTML elements, are passed straight 
through by Zope. They are not a special case, and I think you can 
imagine why you would want HTML comments in rendered HTML documents.

Another way, only DTML elements are dealt with by Zope. The rest is none 
of its business. DTML pretends no knowedge of HTML, and indeed is often 
used entirely separately from HTML.

If you really want to strip all HTML comments out of your DTML 
documents, you can

 - patch Zope to make the comment form a DTML tag approximate to a 
comment. There was a post on this list about doing that for server-side 
include syntax a while back.

- cook the rendered HTML somehow, either by having a Python Script 
render the page, process for comments, and return the result, or by 
extending DTMLDocument and over-riding the __call__ method.

The easiest course is to suck it up and either use dtml-comment (which 
is admittedly verbose for a comment tag) or live with all your comments 
showing up to the client.

          --jcc