我使用nunjucks渲染一些变量:模板渲染错误
<div class="zoomable zoomable-{{ slide.index }}"> << this works
{% if slide.temp is none %} << this doesn't
{% include "layouts/"+{{slide.layout}} %} << this doesn't
{% endif %}
</div>
当JS调用nunjucks.render,我得到以下错误:
parseAggregate: expected colon after dict key
在include
有是这两个问题:
- 它不应该跳过的条件,b因为该属性
temp
不存在。 - 是不是让我访问
slide
属性?因为slide.layout
有效
我做错了什么?
也不知道'none'是一个有效的比较,没有使用nunjucks。也许尝试'如果不是slide.temp' – theleebriggs