Home >Web Front-end >HTML Tutorial >When the jinja2 template generates pages, a large number of blank lines and spaces will be generated. How to remove them? _html/css_WEB-ITnose

When the jinja2 template generates pages, a large number of blank lines and spaces will be generated. How to remove them? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:51:012207browse

For example:

{% if xxx %}  # 空行 1something...{% endif %}   # 空行 2              # 空行 3{% if xxx %}  # 空行 4something...{% endif %}   # 空行 5              # 空行 6{% if xxx %}  # 空行 7something...{% endif %}   # 空行 8


Solution:

Add the "-" symbol to the block.
For example:
------
{%- if test -%}
{%- endif -%}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn