Skip to content

Unhandled syntax error: "else if" is parsed as "else" #899

Open
@laCour

Description

@laCour

The following template has invalid syntax:

{% if false %}
  1
{% else if false %}
  2
{% else %}
  3
{% endif %}

The else if should be elsif, but instead of a SyntaxError being raised, the template is parsed without error and the else if acts as an else. Thus, the above example will always produce 2. This else if should fail to parse since the else has a condition (relevant code).

This can be confusing to end-users since the template is successfully parsed, leading them to believe the template is valid.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions