{{{#!python
from django.template import Template
template1 = Template('{# inline comment #}')
template2 = Template('{% comment %}block comment{% endblock %}')
}}}
the nodelist of the inline comment '''{# ... #}''' will be empty, but the
nodelist of the block comment '''{% comment %}...{% endcomment %}''' will
show the CommentNode.
{{{#!python
print(template1.nodelist)
# -> []
print(template2.nodelist)
# -> [<django.template.defaulttags.CommentNode object at 0x...>]
}}}
The inline comment should also be visible in the nodelist ... as a
CommentNode oder an InlineCommentNode.
--
Ticket URL: <https://code.djangoproject.com/ticket/33243>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* type: Bug => New feature
* resolution: => wontfix
Comment:
The behaviour here has been
[https://github.com/django/django/blob/60b46d72ac81dc5a54b4eaa8ccf1159f83666aa9/django/template/__init__.py#L241-L270
unchanged since the `{# inline comment #}` syntax was introduced] for
#648. I don't think a change is justified; I'd certainly want to see some
consensus for that on the DevelopersMailingList before proceeding.
--
Ticket URL: <https://code.djangoproject.com/ticket/33243#comment:1>