On Apr 6, 9:11 pm, "tonnzor" <[EMAIL PROTECTED]> wrote:
> Short templates comments {# #} are odd if used incorrectly - it eats
> text.
>
> This template (invalid comments):
>
> Hello
> {# this
> comment
> has
> newlines #} World! {{ "some more text" }}
>
> Now produce this output (text "World!" is eaten):
>
> Hello
> some more text
>
> Yes, the comments are invalid, but in this case it should be ignored
> and printed as-is:
>
> Hello
> {# this
> comment
> has
> newlines #} World! some more text
>
> I'm sure that things must work or do not work, not "work sometimes" or
> "do not work and have some side effects".
>
> See also ticket #3888 (http://code.djangoproject.com/ticket/3888)

If it can be changed, I'd also like to see only one comment style: {#
[text] #} with the {##}-notation supporting multiple-line comments. {%
comment %} can either get continued support or be deprecated.

I don't agree with the comment on #3888 that {# ... #} is like "//" in
C-like languages as "//" doesn't require a terminator (like "*/") and
therefor always effects the full line. Thus, "{# ... #}" is much more
like "/* ... */" or "<!-- -->". A "start-comment" - text - "end
comment" style notation should treat all included text as a comment,
including newline and carriage-return characters. Under no
circumstances should it affect anything coming *after* it, so that is
certainly a valid bug. At least an error message has to be generated
in this case, at which point we could also just allow multi-line {##}-
style comments.

I'd like that functionality especially as it would allow for the easy
construction of well-formatted templates that produce spaceless mark-
up like:
<div class="blah">{# eliminate the newline
  #}<span>xyz</span>{#
#}</div>

at least until the spaceless-filter is changed so it actually produces
spaceless mark-up :-) and it would allow for well formatted comments
like:
{#
 # multi-line comment
 #
 #}

which I find more aesthetically pleasing than  the {% comment %} - {%
endcomment %} blocks.

At least a consistent design decision is needed for the 1.0-release.

cheers and happy easter
Jonas


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to