Skip to content

Commit

Permalink
Fixed #2961 -- Added 'opencomment' and 'closecomment' options to {% t…
Browse files Browse the repository at this point in the history
…emplatetag %} templatetag. Thanks for the patch, Jeong-Min Lee

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3938 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrian committed Oct 27, 2006
1 parent ecdb21a commit d1f44f7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
Expand Up @@ -106,7 +106,7 @@ answer newbie questions, and generally made Django that much better:
lakin.wecker@gmail.com
Stuart Langridge <http://www.kryogenix.org/>
Eugene Lazutkin <http://lazutkin.com/blog/>
Jeong-Min Lee
Jeong-Min Lee <falsetru@gmail.com>
Christopher Lenz <http://www.cmlenz.net/>
lerouxb@gmail.com
limodou
Expand Down
6 changes: 5 additions & 1 deletion django/template/defaulttags.py
@@ -1,7 +1,7 @@
"Default tags used by the template system, available to all templates."

from django.template import Node, NodeList, Template, Context, resolve_variable
from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END
from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END
from django.template import get_library, Library, InvalidTemplateLibrary
from django.conf import settings
import sys
Expand Down Expand Up @@ -295,6 +295,8 @@ class TemplateTagNode(Node):
'closevariable': VARIABLE_TAG_END,
'openbrace': SINGLE_BRACE_START,
'closebrace': SINGLE_BRACE_END,
'opencomment': COMMENT_TAG_START,
'closecomment': COMMENT_TAG_END,
}

def __init__(self, tagtype):
Expand Down Expand Up @@ -831,6 +833,8 @@ def templatetag(parser, token):
``closevariable`` ``}}``
``openbrace`` ``{``
``closebrace`` ``}``
``opencomment`` ``{#``
``closecomment`` ``#}``
================== =======
"""
bits = token.contents.split()
Expand Down
4 changes: 4 additions & 0 deletions docs/templates.txt
Expand Up @@ -800,8 +800,12 @@ The argument tells which template bit to output:
``closevariable`` ``}}``
``openbrace`` ``{``
``closebrace`` ``}``
``opencomment`` ``{#``
``closecomment`` ``#}``
================== =======

Note: ``opencomment`` and ``closecomment`` are new in the Django development version.

widthratio
~~~~~~~~~~

Expand Down
2 changes: 2 additions & 0 deletions tests/regressiontests/templates/tests.py
Expand Up @@ -552,6 +552,8 @@ def test_templates(self):
'templatetag08': ('{% templatetag closebrace %}', {}, '}'),
'templatetag09': ('{% templatetag openbrace %}{% templatetag openbrace %}', {}, '{{'),
'templatetag10': ('{% templatetag closebrace %}{% templatetag closebrace %}', {}, '}}'),
'templatetag11': ('{% templatetag opencomment %}', {}, '{#'),
'templatetag12': ('{% templatetag closecomment %}', {}, '#}'),

### WIDTHRATIO TAG ########################################################
'widthratio01': ('{% widthratio a b 0 %}', {'a':50,'b':100}, '0'),
Expand Down

0 comments on commit d1f44f7

Please sign in to comment.