Ticket #8652: django-multiline-tags-with-no-raw-r8662.diff
File django-multiline-tags-with-no-raw-r8662.diff, 2.1 KB (added by , 16 years ago) |
---|
-
django/template/__init__.py
79 79 COMMENT_TAG_END = '#}' 80 80 SINGLE_BRACE_START = '{' 81 81 SINGLE_BRACE_END = '}' 82 RAW_TAG_START = '{$' 83 RAW_TAG_END = '$}' 82 84 83 85 ALLOWED_VARIABLE_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.' 84 86 … … 87 89 UNKNOWN_SOURCE="<unknown source>" 88 90 89 91 # match a variable or block tag and capture the entire tag, including start/end delimiters 90 tag_re = re.compile('(%s.*?%s|%s.*?%s|%s.*?%s )' % (re.escape(BLOCK_TAG_START), re.escape(BLOCK_TAG_END),92 tag_re = re.compile('(%s.*?%s|%s.*?%s|%s.*?%s|%s.*?%s)' % (re.escape(BLOCK_TAG_START), re.escape(BLOCK_TAG_END), 91 93 re.escape(VARIABLE_TAG_START), re.escape(VARIABLE_TAG_END), 92 re.escape(COMMENT_TAG_START), re.escape(COMMENT_TAG_END))) 94 re.escape(COMMENT_TAG_START), re.escape(COMMENT_TAG_END), 95 re.escape(RAW_TAG_START), re.escape(RAW_TAG_END)), re.S) 93 96 94 97 # global dictionary of libraries that have been loaded using get_library 95 98 libraries = {} … … 221 224 otherwise it should be treated as a literal string. 222 225 """ 223 226 if in_tag: 224 if token_string.startswith(VARIABLE_TAG_START): 227 if token_string.startswith(RAW_TAG_START): 228 token = Token(TOKEN_TEXT, token_string[len(RAW_TAG_START):-len(RAW_TAG_END)].strip()) 229 elif token_string.startswith(VARIABLE_TAG_START): 225 230 token = Token(TOKEN_VAR, token_string[len(VARIABLE_TAG_START):-len(VARIABLE_TAG_END)].strip()) 226 231 elif token_string.startswith(BLOCK_TAG_START): 227 232 token = Token(TOKEN_BLOCK, token_string[len(BLOCK_TAG_START):-len(BLOCK_TAG_END)].strip()) … … 229 234 token = Token(TOKEN_COMMENT, '') 230 235 else: 231 236 token = Token(TOKEN_TEXT, token_string) 237 232 238 return token 233 239 234 240 class Parser(object):