Opened 8 years ago

Closed 7 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: master
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


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.



[3] source:django/trunk/django/template/

Attachments (1)

r17141-howto-custom-template-tags-comment.diff (1.6 KB) - added by Sebastian Goll 7 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 7 years ago by Sebastian Goll

Has patch: set

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.)

Changed 7 years ago by Sebastian Goll

comment:2 Changed 7 years ago by Claude Paroz

Triage Stage: AcceptedReady for checkin
Version: 1.3SVN

comment:3 Changed 7 years ago by Chris Beaven

Resolution: fixed
Status: newclosed

In [17663]:

Fixed #16939 -- Inaccurate implementation of {% comment %} presented in custom template tag 'howto' guide. Thanks sebastian for the patch.

Note: See TracTickets for help on using tickets.
Back to Top