Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #16939 -- Inaccurate implementation of {% comment %} presented …

…in custom template tag 'howto' guide. Thanks sebastian for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17663 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5ccc6f17b8452ef1377755d21148036dc0c88ba0 1 parent ad97f0e
Chris Beaven authored
10  docs/howto/custom-template-tags.txt
@@ -1155,7 +1155,7 @@ Template tags can work in tandem. For instance, the standard
1155 1155
 To create a template tag such as this, use ``parser.parse()`` in your
1156 1156
 compilation function.
1157 1157
 
1158  
-Here's how the standard :ttag:`{% comment %}<comment>` tag is implemented:
  1158
+Here's how a simplified ``{% comment %}`` tag might be implemented:
1159 1159
 
1160 1160
 .. code-block:: python
1161 1161
 
@@ -1168,6 +1168,14 @@ Here's how the standard :ttag:`{% comment %}<comment>` tag is implemented:
1168 1168
         def render(self, context):
1169 1169
             return ''
1170 1170
 
  1171
+.. note::
  1172
+    The actual implementation of :ttag:`{% comment %}<comment>` is slightly
  1173
+    different in that it allows broken template tags to appear between
  1174
+    ``{% comment %}`` and ``{% endcomment %}``. It does so by calling
  1175
+    ``parser.skip_past('endcomment')`` instead of ``parser.parse(('endcomment',))``
  1176
+    followed by ``parser.delete_first_token()``, thus avoiding the generation of a
  1177
+    node list.
  1178
+
1171 1179
 ``parser.parse()`` takes a tuple of names of block tags ''to parse until''. It
1172 1180
 returns an instance of ``django.template.NodeList``, which is a list of
1173 1181
 all ``Node`` objects that the parser encountered ''before'' it encountered
2  docs/ref/templates/builtins.txt
@@ -51,7 +51,7 @@ Defines a block that can be overridden by child templates. See
51 51
 comment
52 52
 ^^^^^^^
53 53
 
54  
-Ignores everything between ``{% comment %}`` and ``{% endcomment %}``
  54
+Ignores everything between ``{% comment %}`` and ``{% endcomment %}``.
55 55
 
56 56
 .. templatetag:: csrf_token
57 57
 

0 notes on commit 5ccc6f1

Please sign in to comment.
Something went wrong with that request. Please try again.