jsonjinja
jsonjinja copied to clipboard
Jinja "If" operators are not being rendered as valid Javascript
Howdy:
If I have a simple template/html file such as:
<ul>
{% if page == "homepage" -%}
<li><a class="active href="#">Home</a></li>
{%- else -%}
<li><a href="#">Home</a></li>
{%- endif %}
</ul>
The resulting Javscript is missing the == operator, like so:
if (l_page_0"homepage") {
w("<li><a class="active href="#">Home</a></li>");
} else {
w("<li><a href="#">Home</a></li>");
}
... when it should obviously be like so:
if (l_page_0 == "homepage") {
w("<li><a class="active href="#">Home</a></li>");
} else {
w("<li><a href="#">Home</a></li>");
}
I tried to grok the source and come up with a simple solution, but alas, no dice.
Hopefully I haven't messed something up on my end and this can be a simple fix?
Thanks for all you do!
I have the exact same problem.