连字符对于 Twig 中的块意味着什么,例如 {% block body -%}? [英] What does the hyphen mean for a block in Twig like in {% block body -%}?

查看:11
本文介绍了连字符对于 Twig 中的块意味着什么,例如 {% block body -%}?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用 Doctrine 命令在 Symfony2 应用程序中生成 CRUD 时,生成的 Twig 模板内容在 Twig 块中以这种方式定义:

When generating a CRUD in a Symfony2 application with Doctrine commands, generated Twig template content is defined within a Twig block this way:

{% block body -%}

{% endblock %}

-%} 中的连字符是什么意思?没有连字符就可以正常工作,我在 Twig 文档中找不到类似的东西.

What does the hyphen in -%} mean? It works fine without the hyphen and I could not find anything similar in the Twig documentation.

推荐答案

-%} 表示修剪空白.

请参阅文档的 空白控制部分.

这篇关于连字符对于 Twig 中的块意味着什么,例如 {% block body -%}?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆