Opened 13 years ago
Closed 13 years ago
#16939 closed Bug (fixed)
Inaccurate implementation of {% comment %} presented in custom template tag 'howto' guide
Reported by: | Julien Phalip | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Two sections (see [1]
and [2]
) of the custom template tag howto guide illustrate an obsolete implementation (6 years old! -- see r1964) of the built-in {% comment %}
tag. Those should be updated either to reflect the new implementation (see in [3]
) or to provide a different example.
[1]
https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#parsing-until-another-block-tag
[3]
source:django/trunk/django/template/defaulttags.py?rev=16908#L480
Attachments (1)
Change History (4)
comment:1 by , 13 years ago
Has patch: | set |
---|
by , 13 years ago
Attachment: | r17141-howto-custom-template-tags-comment.diff added |
---|
comment:2 by , 13 years ago
Triage Stage: | Accepted → Ready for checkin |
---|---|
Version: | 1.3 → SVN |
Note:
See TracTickets
for help on using tickets.
Here is an attempt at updating the documentation. It still keeps the actual
{% comment %}
example since I think it's still valid, but adds a note highlighting the differences to the actual implementation.I still like the simplified
{% comment %}
example because it leads to the more elaborate{% upper %}
tag in the following section. First we parse the node list but simply ignore it, later we actually use it and run a transformation on it.Coming up with a completely new introductory example seems not necessary, and with the note regarding the actual implementation of
{% comment %}
it should be clear that this is only an example, usually one would still use the standard{% comment %}
tag for actually commenting out template code.(The note has the added effect of introducing
parser.skip_past()
which I wasn't aware of until now. – Slightly unrelated, the patch also fixes a missing period in the single-sentence documentation of the actual{% comment %}
tag.)