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. -Asad
Asad Habib <ahabib@engin.umich.edu> writes:
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.
-Asad
When I used to use DTML, I used to do stuff like this all of the time: <!-- Start Header --> <dtml-var custom_header> <!-- End Header --> That when when I had problems with the rendered output I would have a better idea which DTML method was wrecking my day. Is this what you mean? A quick test shows that you can do stuff like: <!-- stupid <dtml-var document_id> comment --> Stuff like this is pretty easy to test. Just create a DTML method and start sticking in comments. Jason
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
participants (3)
-
Asad Habib -
J Cameron Cooper -
Jason Earl