下面的代码是我用来学习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>发布于 2009-09-22 17:39:20
我想你把台词搞混了。你的endif在endfilter之前,而if在filter之前。这只是一个语法错误。
https://stackoverflow.com/questions/1461484
复制相似问题