Open mhayk opened 5 years ago
I don't think this is a bug. Jinja2 has the same behavior.
>>> from jinja2 import DictLoader, Environment
>>> env = Environment(loader=DictLoader({
... 'base.html': '{% block foo %}FOO{% endblock %}',
... }))
>>> env.from_string('{% extends "base.html" %}').render()
'FOO'
>>> env.from_string('{% extends "base.html " %}').render()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
[...]
jinja2.exceptions.TemplateNotFound: base.html
Why not just remove the extra space from your template?
@fdintino this helps the developer to avoid spend a lot of time trying to figure out that it has added a space. This is a smart way to continue rendering the page.
When you try to extends a template with whitespace like:
{% extends "_layouts/default.njk " %}
the parser throw the error:Error: template not found: _layouts/default.njk