Recent commits to the reference implementation have highlighted an incompatibility in the way we handle {% break %} and {% continue %} tags that appear outside of a {% for %} block.
Consider this template:
{%- if true -%}
before
{%- if true %}
hello{% break %}goodbye
{% endif -%}
after
{%- endif -%}
{% for x in (1..3) %}
{{ x }}
{% endfor %}
{% for x in (1..3) %}
{{ x }}
{% endfor %}
Ruby Liquid output in both strict and lax modes:
Python Liquid raises a LiquidSyntaxError in strict mode and jumps over the entire outer {% if %} block in lax mode.
Not for the first time, I'm torn between strict compatibility and what I consider to be more natural, expected and consistent behaviour, even for non-dev template authors.
Recent commits to the reference implementation have highlighted an incompatibility in the way we handle
{% break %}and{% continue %}tags that appear outside of a{% for %}block.Consider this template:
{%- if true -%} before {%- if true %} hello{% break %}goodbye {% endif -%} after {%- endif -%} {% for x in (1..3) %} {{ x }} {% endfor %} {% for x in (1..3) %} {{ x }} {% endfor %}Ruby Liquid output in both strict and lax modes:
Python Liquid raises a
LiquidSyntaxErrorin strict mode and jumps over the entire outer{% if %}block in lax mode.Not for the first time, I'm torn between strict compatibility and what I consider to be more natural, expected and consistent behaviour, even for non-dev template authors.