Opened 4 years ago
Closed 4 years ago
#33243 closed New feature (wontfix)
Inline comment vanishes in parsed template, comment block is represented as CommentNode
| Reported by: | D. W. | Owned by: | nobody |
|---|---|---|---|
| Component: | Template system | Version: | 4.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
When parsing a template via
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.
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.
Change History (1)
comment:1 by , 4 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
| Type: | Bug → New feature |
Note:
See TracTickets
for help on using tickets.
The behaviour here has been 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.