Ticket #4164: template_lexer.diff
File template_lexer.diff, 1.1 KB (added by , 18 years ago) |
---|
-
__init__.py
199 199 200 200 def create_token(self,token_string): 201 201 "Convert the given token string into a new Token object and return it" 202 if token_string.startswith(VARIABLE_TAG_START) :202 if token_string.startswith(VARIABLE_TAG_START) and token_string.endswith(VARIABLE_TAG_END): 203 203 token = Token(TOKEN_VAR, token_string[len(VARIABLE_TAG_START):-len(VARIABLE_TAG_END)].strip()) 204 elif token_string.startswith(BLOCK_TAG_START) :204 elif token_string.startswith(BLOCK_TAG_START) and token_string.endswith(BLOCK_TAG_END): 205 205 token = Token(TOKEN_BLOCK, token_string[len(BLOCK_TAG_START):-len(BLOCK_TAG_END)].strip()) 206 elif token_string.startswith(COMMENT_TAG_START) :206 elif token_string.startswith(COMMENT_TAG_START) and token_string.endswith(COMMENT_TAG_END): 207 207 token = Token(TOKEN_COMMENT, '') 208 208 else: 209 209 token = Token(TOKEN_TEXT, token_string)