Ticket #4171: forbide_newlines_in_tags.diff
File forbide_newlines_in_tags.diff, 1.1 KB (added by , 17 years ago) |
---|
-
__init__.py
93 93 re.escape(COMMENT_TAG_START), re.escape(COMMENT_TAG_END))) 94 94 # matches if the string is valid number 95 95 number_re = re.compile(r'[-+]?(\d+|\d*\.\d+)$') 96 newline_re = re.compile(r'[\n\r]') 96 97 97 98 # global dictionary of libraries that have been loaded using get_library 98 99 libraries = {} … … 199 200 200 201 def create_token(self,token_string): 201 202 "Convert the given token string into a new Token object and return it" 202 if token_string.startswith(VARIABLE_TAG_START): 203 if newline_re.search(token_string): 204 token = Token(TOKEN_TEXT, token_string) 205 elif token_string.startswith(VARIABLE_TAG_START): 203 206 token = Token(TOKEN_VAR, token_string[len(VARIABLE_TAG_START):-len(VARIABLE_TAG_END)].strip()) 204 207 elif token_string.startswith(BLOCK_TAG_START): 205 208 token = Token(TOKEN_BLOCK, token_string[len(BLOCK_TAG_START):-len(BLOCK_TAG_END)].strip())