On Sunday, October 30, 2011 6:45:02 AM UTC-4, peter wrote:
>
> I am seeing the comments like a programmer sees comments


Yes, but as a programmer, you have to use the correct comment syntax for 
the language you are using. In the web2py template language, everything 
outside {{ }} is left as is in the generated output. You can comment out 
code within {{ }}, but you obviously have to use Python comments for that.

Keep in mind that web2py templates can generate any type of output (JSON, 
XML, Javascript, CSS, or any arbitrary language/markup), not just HTML. It 
would not be expected or desirable for it to parse the comment syntax for 
all possible target languages and completely remove the content within. 
Rather, you want the template language to be able to generate comments in 
the target language if needed. This is particularly important in HTML 
because in HTML, sometimes you do actually want the browser to execute 
content within comments (e.g., HTML comments are used to create conditional 
markup for IE and to hide Javascript code within script tags from 
non-Javascript browsers).
 

> However for a programmer, having things within comments 
> execute is an 'unexpected behaviour'.


Though if you tried to generate an HTML comment using the template language 
but found the content of that comment to be empty within the generated 
HTML, that would also be unexpected behavior.

Anthony

Reply via email to