我使用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
这有两个问题:
temp
不存在。slide
属性?因为
slide.layout
有效我做错了吗?
答案 0 :(得分:2)
我认为你只需删除curly brackets
即
{% include "layouts/" + slide.layout %}