浏览代码

Remove a backported verbatim tag now that we are using Django 1.5

tags/v1.0.0
Krzysztof Klimonda 11 年前
父节点
当前提交
ba8a8ca7c6
共有 2 个文件被更改,包括 0 次插入45 次删除
  1. +0
    -44
      pinry/core/templatetags/verbatim.py
  2. +0
    -1
      pinry/pins/templates/pins/recent_pins.html

+ 0
- 44
pinry/core/templatetags/verbatim.py 查看文件

@@ -1,44 +0,0 @@
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
to output the contents with no changes.
"""
from django import template
register = template.Library()
class VerbatimNode(template.Node):
def __init__(self, text):
self.text = text
def render(self, context):
return self.text
@register.tag
def verbatim(parser, token):
text = []
while 1:
token = parser.tokens.pop(0)
if token.contents == 'endverbatim':
break
if token.token_type == template.TOKEN_VAR:
text.append('{{')
elif token.token_type == template.TOKEN_BLOCK:
text.append('{%')
text.append(token.contents)
if token.token_type == template.TOKEN_VAR:
text.append('}}')
elif token.token_type == template.TOKEN_BLOCK:
text.append('%}')
return VerbatimNode(''.join(text))

+ 0
- 1
pinry/pins/templates/pins/recent_pins.html 查看文件

@@ -1,5 +1,4 @@
{% extends 'core/base.html' %}
{% load verbatim %}

{% block title %}Recent Pins{% endblock %}



正在加载...
取消
保存