#648 closed defect (fixed)
[patch] Add a comment tag like {# commented #}
Reported by: | hegemon | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Template system | Version: | |
Severity: | minor | Keywords: | |
Cc: | mccutchen@…, gary.wilson@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The default {% comment %} {% endcomment %} block is too much writing.
Attachments (2)
Change History (11)
comment:1 by , 19 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 19 years ago
I think a {# balbalbla #} would be much nicer for comments then the unreadable and blowisch comment tag.
With those 3 types everything would be covered. With the current syntax for comments, i hardly doubt that people make comments at all, and if so, they are hard to read.
comment:3 by , 18 years ago
Summary: | Add a comment tag like {%# >>commented {{ code }}<< %} → Add a comment tag like {# commented #} |
---|---|
Type: | → defect |
comment:4 by , 18 years ago
Summary: | Add a comment tag like {# commented #} → [patch] Add a comment tag like {# commented #} |
---|
I think that this is a valuable proposal...
It will make code much more readable, and will encourage the use of comments...
{% if somecondition %} foo {% else %}{% comment %}not somecondition{% endcomment %} bar {% endif %}
is not readable, and I don't think it seems Django-ish... it's inelegant.
{% if somecondition %} foo {% else %} {# not somecondition #} bar {% endif %}
is much more readable
I'm uploading a patch for consideration.
comment:5 by , 18 years ago
Cc: | added |
---|
I'm attaching a new diff that adds tests to the previous diff. This one was made from the root of django_src
instead of from the django_src/tests/regressiontests/templates
directory, it may be easier to apply.
I really think better comment syntax would be a boon to Django's template system.
by , 18 years ago
Attachment: | comment_syntax_with_tests.diff added |
---|
New patch, including tests, against r3754
comment:8 by , 18 years ago
I'm totally fan of this (even implemented it half way on my sendbox, but forgott about it).
I think this patch increases the usage of comments a log, currenty, I rarly comment anything, because it makes the template even less readable. This is very problematic for complex templates. for example, i have some templates that generate .DOT and kml files, and have to make calculations to generate some values (no, the calculation is on the right place here, because i generates colors, length, etc out of numeric values). doing such things are very ugly in templates and hard to read anyways, without comments, outsiders can't do changes due a lack of understanding, at least they told me so :)
comment:9 by , 18 years ago
Resolution: | wontfix → fixed |
---|
Two different types of syntax -- {% %} and {{ }} -- is already more than enough for our template system. We shall not go down a Perlish path! :)