Skip to content

Jinja "If" operators are not being rendered as valid Javascript #2

@ozburo

Description

@ozburo

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions