-
-
Notifications
You must be signed in to change notification settings - Fork 219
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
Assignment inside block does not compile as expected #227
Comments
Is there anything else you need from me to investigate this? |
Not really -- it's just been really busy. I hope to get to it soon! |
Similarly, this also happens inside Assuming the template contains {% if title.is_some() %}
{% let t = title.unwrap() %}
{{ t }}
{% endif %} In case someone finds this issue, like I did. Then currently, a possible workaround is to declare the name before the if statement, like this: {% let t %}
{% if title.is_some() %}
{%- let t = title.unwrap() %}
{{ t }}
{% endif %} |
Thanks for the reports, and sorry for the long wait. This has now been fixed. |
I think I encountered a similar problem @djc The code below returns an error
The error is
|
Is this with a released version? Might want to try it with master, I think we've had some fixes related to this (if it still fails, please file a new issue). |
@jhoobergs to reassure what @djc said. That particular example currently works and was fixed in PR #411. It has not been released yet, so as a workaround, you can change your dependency to use the repository in the meantime. [dependencies]
askama = { git = "https://github.com/djc/askama", rev = "000aff4a18c90a5074afd1af5587ff94e915e7d1" } |
Here's the setup:
base.html:
test.html:
main.rs:
This fails to compile:
But oddly enough if you add an empty loop to the template it works:
{% extends "base.html" %} {% block title %}Test{% endblock %} {% block body %} {% let foo = 123 %} {{ foo }} {% for x in [1] %}{% endfor %} <!-- this line --> {% endblock %}
The text was updated successfully, but these errors were encountered: