-
Notifications
You must be signed in to change notification settings - Fork 12
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
Reimplement {% filter %}
block
#73
Reimplement {% filter %}
block
#73
Conversation
ea6b71a
to
064ce2e
Compare
I did not understand the code of My implementation seems to be sane, but your tests, @GuillaumeGomez, expect different whitespaces than my code emits. To me it looks like my implementation works correctly. Could you please have a look if the tests or the implementation is wrong? |
ad2cb30
to
451e75c
Compare
The output seems correct indeed. The code looks code as well. Very good idea to use a closure! Some tests of mine are missing. If you don't mind, I'll merge #71, like that you will have tests already and will just need to update them. |
Sure, that's the simplest solution! |
Perfect thanks! Just waiting for your review before merging it then. ;) |
Ok, a rebase and fixed tests and then please ping me for review. :) |
In my opinion it's much easier to read than `&mut (impl …)`. Also, it might come in handy to have access to the type in the generator.
The case can occur in filter blocks. In a normal filter expression, we don't emit the auto escaper code for `|safe` or `|escape`.
This PR reimplements the code generation for `{% filter %}` blocks, so that the data is written directly into its destination writer, without using a buffer. This way it behaves like a specialized `{{ expr|filter1|filter2 }}` would, if the `expr` was a `Template` that contained the body of the filter block.
451e75c
to
10e67fa
Compare
{% filter %}
block{% filter %}
block and make paragraphbreaks
safe by default
This is so much better, thanks a lot! I also updated the title of the PR about the |
Thank you! Yeah, I assumed that this feature could be implemented with a closure and after a while of testing it actually worked! :)
Oops, I didn't do that in this PR. :/ I only changed |
Woups. Being woken up too early by the cat is bad for my brain haha. Please fix my fix of the title. ^^' |
{% filter %}
block and make paragraphbreaks
safe by default{% filter %}
block
This PR reimplements the code generation for
{% filter %}
blocks, so that the data is written directly into its destination writer, without using a buffer. This way it behaves like a specialized{{ expr|filter1|filter2 }}
would, if theexpr
was aTemplate
that contained the body of the filter block.