質問
以下のコードは、私はJinja2のを学ぶために使用しているサンプルフォームです。書かれたように、それは{%ENDIF%}タグを認識しないというエラーを返します。これはなぜ起こるのでしょうか?
<html>
Name: {{ name }}
Print {{ num }} times
Color: {{ color }}
{% if convert_to_upper %}Case: Upper
{% elif not convert_to_upper %}Case: Lower{% endif %}
{% for repeats in range(0,num) %}
{% if convert_to_upper %}
{% filter upper %}
{% endif %}
<li><p style="color:{{ color }}">{{ name }}</style></li>
{% endfilter %}
{% endfor %}
</html>
解決
私はあなたの行が混ざっ持っていると思います。 endif
一方endfilter
前に、あなたのif
のcomeseはfilter
の前にあります。それはちょうど、構文エラーです。
所属していません StackOverflow