nunjucks过滤器(非过滤器)示例

时间:2019-04-15 13:39:57

标签: nunjucks

在nunjucks中有两种过滤器。

1,过滤http://mozilla.github.io/nunjucks/templating.html#filters

示例

{{ foo | title }}
{{ foo | join(",") }}
{{ foo | replace("foo", "bar") | capitalize }}

2,过滤http://mozilla.github.io/nunjucks/templating.html#filter

它说:

A filter block allows you to call a filter with the contents of the block. 
Instead passing a value with the | syntax, the render contents from the 
block will be passed.

示例

{% filter title %}
may the force be with you
{% endfilter %}
{% filter replace("force", "forth") %}
may the force be with you
{% endfilter %}

我无法理解上述示例中的第二个过滤器。如果有人可以举一个完整的例子?

0 个答案:

没有答案