]> Devi Nivas Git - chevron.git/commitdiff
Move the last literal yield up higher
authornoah morrison <noah@morrison.ph>
Sat, 15 Nov 2014 03:23:45 +0000 (22:23 -0500)
committernoah morrison <noah@morrison.ph>
Sat, 15 Nov 2014 03:23:45 +0000 (22:23 -0500)
Moved it above the standalone checking

entei.py

index c1e218d65d657d54e9ada7a93626265a02705b74..e68ae4056c802fbd85c4ad04ac7b0061431c108e 100755 (executable)
--- a/entei.py
+++ b/entei.py
@@ -76,6 +76,10 @@ def tokenize(template):
     while not template.is_finished:
         literal = grab_literal()
 
+        if template.is_finished:
+            yield ('literal', literal)
+            break
+
         if literal.find('\n') != -1 or is_standalone:
             padding = literal.split('\n')[-1]
             if padding.isspace() or padding == '':
@@ -83,10 +87,6 @@ def tokenize(template):
             else:
                 is_standalone = False
 
-        if template.is_finished:
-            yield ('literal', literal)
-            break
-
         tag_key = get(1)
         tag_type = tag_types.get(tag_key, 'variable')
         if tag_type != 'variable':