mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #1176 -- Changed {% comment %} template tag not to generate a nodelist, so it's now possible to comment-out broken template tags. Thanks, Kieran Holland
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1964 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -311,6 +311,13 @@ class Parser(object):
|
||||
self.unclosed_block_tag(parse_until)
|
||||
return nodelist
|
||||
|
||||
def skip_past(self, endtag):
|
||||
while self.tokens:
|
||||
token = self.next_token()
|
||||
if token.token_type == TOKEN_BLOCK and token.contents == endtag:
|
||||
return
|
||||
self.unclosed_block_tag([endtag])
|
||||
|
||||
def create_variable_node(self, filter_expression):
|
||||
return VariableNode(filter_expression)
|
||||
|
||||
|
||||
@@ -286,8 +286,7 @@ def comment(parser, token):
|
||||
"""
|
||||
Ignore everything between ``{% comment %}`` and ``{% endcomment %}``
|
||||
"""
|
||||
nodelist = parser.parse(('endcomment',))
|
||||
parser.delete_first_token()
|
||||
parser.skip_past('endcomment')
|
||||
return CommentNode()
|
||||
comment = register.tag(comment)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user