-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parent loop index for nested loop is wrong #46
Comments
Seems there are more bugs with nested loop. The loop.* values of the outer loop will be overwritten by the inner loop. Before running the inner loop the values are correct, after the outerloop they are wrong. Seems the variable scope of the loop.*-variables is not set correctly. |
Yeah, looks like the for loop isn't properly setting the loop object on the context. Should be a pretty straightforward fix. I think I'll finally have a chance to sit down today and go through all the bugs you've submitted, so look for comments and fixes later on today. |
Hi, you don't have to invest time especially for me, do it when you've time for ;) "Fixed" all this bugs by twig's "set" command and storing local copies before calling any nested for-loop. |
This should be fixed now, nested for loops won't override the parent loop variable anymore. |
Parent loops are working but variables set by the "set"-command have now a wrong variable scope:
Expected: |
This is because loops now have their own internal context to keep the loop variable separate, which is how they should have been implemented before (it's why parent was having problems). I'll have to update the set function to affect the global context as well as the local. |
Twig.Template functions are now on the prototype.
This is fixed and available in 0.4.6. |
Hi, me again. Sorry for finding all those bugs ;)
Template:
Expected Output:
Actual Output:
The text was updated successfully, but these errors were encountered: