Skip to content
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

Templates in templates need "none" escape #1088

Closed
malteneuss opened this issue Aug 26, 2024 · 2 comments · Fixed by #1089
Closed

Templates in templates need "none" escape #1088

malteneuss opened this issue Aug 26, 2024 · 2 comments · Fixed by #1089

Comments

@malteneuss
Copy link
Contributor

When rendering templates in templates like https://github.com/djc/askama/blob/main/book/src/template_syntax.md#templates-in-templates, the inner templates needs to be rendered without escaping; otherwise the Html of the inner template is printed literally.

If that that's the intended behavior, feel free to close this issue.

Otherwise, the tests in https://github.com/djc/askama/blob/main/testing/tests/render_in_place.rs should include Html tags to not miss that in the future. In the mean time, a workaround is to disable escaping manually:

{% for my_template in my_templates %}
      {{ my_template|escape("none") }}
{% endfor %}
@rinja-rs rinja-rs deleted a comment Aug 26, 2024
@djc
Copy link
Collaborator

djc commented Aug 26, 2024

It's not exactly intended behavior, though I think it is expected behavior. Because of the lack of specialization in Rust, fixing this problem isn't trivial.

@malteneuss
Copy link
Contributor Author

I see. Then mentioning a workaround in the book may be good enough for now: https://github.com/djc/askama/pull/1089

@djc djc closed this as completed in #1089 Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@djc @malteneuss and others