]> Devi Nivas Git - chevron.git/commitdiff
Fix #48
authorDaniel Morrison <dan@morrison.ph>
Sun, 7 Apr 2019 14:55:57 +0000 (10:55 -0400)
committerDaniel Morrison <dan@morrison.ph>
Sun, 7 Apr 2019 14:55:57 +0000 (10:55 -0400)
Turns out some weird scoping things were happening.

The `scopes` variable is being passed throughout by reference.

Which is great (yay speed improvements). In theory. Except...

All operations must therefore operate on scopes by reference.

`scopes = scopes[1:]` used to end a scope updates the reference.
This means the parent call to renderer doesn't leave the scope.

chevron/renderer.py

index 788e2bb799ebe35de2224aa1b8a0160ccb76e05b..f0c40324f47ad13bc86a88cf251d2ecd35d1c5df 100644 (file)
@@ -194,7 +194,7 @@ def render(template='', data={}, partials_path='.', partials_ext='mustache',
         # If we're an end tag
         if tag == 'end':
             # Pop out of the latest scope
-            scopes = scopes[1:]
+            del scopes[0]
 
         # If the current scope is falsy and not the only scope
         elif not current_scope and len(scopes) != 1: