Ticket #4164: template_lexer.diff

File template_lexer.diff, 1.1 KB (added by tonnzor <tonn81@…>, 11 years ago)
  • __init__.py

     
    199199
    200200    def create_token(self,token_string):
    201201        "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):
    203203            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):
    205205            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):
    207207            token = Token(TOKEN_COMMENT, '')
    208208        else:
    209209            token = Token(TOKEN_TEXT, token_string)
Back to Top