We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If a line inside a template contains only templatel directives and whitespace, the complete line should be removed from the output when rendered.
Use case 1:
template for RSS xml feed:
{# feed.xml; -*- Mode: jinja2; -*- #} <?xml version="1.0" encoding="UTF-8" ?>
is rendered like
<?xml version="1.0" encoding="UTF-8" ?>
Note the empty line at the begining is making this file invalid xml file.
Use case 2:
<ul> {% for post in posts %} <li> <section> <h3>{{ post.date|strftime(date_format) }} - <a href="{{ post.url }}">{{ post.title }}</a></h3> {% if post.description %}<p>{{ post.description }}</p>{% endif %} </section> </li> {% endfor %} </ul>
this renders the html output like this:
<li> <section> <h3>2019-02-22 - <a href="">title 1</a></h3> <p>description</p> </section> </li> <li> <section> <h3>2016-11-22 - <a href="">title 2</a></h3> </section> </li> <li> <section> <h3>2016-01-04 - <a href="">title 3</a></h3> </section> </li>
While the html is valid, it looks ugly with all those empty lines.
As an (aesthetical) enhancement it would be good if templatel would not render at all line that contains only templatel tags and whitespace.
The text was updated successfully, but these errors were encountered:
yeah, it'd be great to support what jinja calls whitespace-control!
Sorry, something went wrong.
I also bump into this issue, would be great to have this support.
I also tried something like {% if abc -%} but it says invalid syntax..
{% if abc -%}
bump the request
No branches or pull requests
If a line inside a template contains only templatel directives and whitespace, the complete line should be removed from the output when rendered.
Use case 1:
template for RSS xml feed:
is rendered like
Note the empty line at the begining is making this file invalid xml file.
Use case 2:
this renders the html output like this:
While the html is valid, it looks ugly with all those empty lines.
As an (aesthetical) enhancement it would be good if templatel would not render at all line that contains only templatel tags and whitespace.
The text was updated successfully, but these errors were encountered: