-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Add {% break %} and {% continue %} #519
Conversation
This looks like a nice straightforward implementation, but it looks like this would not throw any error if |
I implemented the check inside of the parsing step. It was easier to implement, and it has the added bonus that the user gets informed about the exact position of the offending {%break%}. This was the first time I had to use a Cell. Does this mean I can call myself a Rust programmer now? ;) |
Why do we need to use (Here, too, I wonder: do you have use cases for these constructs?) |
Note that Jinja does not allow this:
|
Replaced State cannot be passed mutable because it's captured by multiple closures.
I used it before in Flask apps. You don't have to use break or continue in templates, since you can always put more logic into the Rust code and less in the template code, but I guess that's a matter of taste.
After 13 years, can we call an extension part of the standard? :) |
If you rebase this, I'm happy to merge it. Sorry for the long review cycle! |
This PR adds `{% break %}` and `{% continue %}` statements to break out of a loop, or continue with the next element of the iterator.
No problem. Rebased. |
Thanks! |
This PR adds
{% break %}
and{% continue %}
statements to break outof a loop, or continue with the next element of the iterator.