A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/jinja2cpp/Jinja2Cpp/issues/159 below:

Difference of LstripBlocks behavior with Jinja2 · Issue #159 · jinja2cpp/Jinja2Cpp · GitHub

Hi, I notice that Jinja2Cpp and Jinja2 print different results using this template.
The settings trimBlocks and lstripBlocks are set to true in both cases.

{% for i in range(1) %}
   i = {{i}}
{% endfor %}

From Jinja2: i = 0
From Jinja2Cpp: i =0

It raises the question: are {{}} supposed to be affected by lstripBlocks?
Remark: it becomes identical if I substitute {{+i}} instead of {{i}}

The reference python code:

#!/usr/bin/env python
import sys
from jinja2 import Environment, FileSystemLoader
env = Environment(
    loader=FileSystemLoader('.'),
    lstrip_blocks=True, trim_blocks=True
)
template = env.get_template(sys.argv[1])
print(template.render())

using Jinja 2.10.3


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4