Skip to content

Known issues

This page documents known compatibility issues between Python Liquid's default Environment and Shopify/liquid, the reference implementation written in Ruby. We strive to be 100% compatible with Shopify/liquid. That is, given an equivalent render context, a template rendered with Python Liquid should produce the same output as when rendered with Ruby Liquid.

Coercing Strings to Integers Inside Filters

See issue #49

Many filters built in to Liquid will automatically convert a string representation of a number to an integer or float as needed. When converting integers, Ruby Liquid uses Ruby's String.to_i method, which will disregard trailing non-digit characters. In the following example, '7,42' is converted to 7

template:

{{ 3.14 | plus: '7,42' }}
{{ '123abcdef45' | plus: '1,,,,..!@qwerty' }}

output

10.14
124

Python Liquid currently falls back to 0 for any string that can't be converted to an integer in its entirety. As is the case in Ruby Liquid for strings without leading digits.

This does not apply to parsing of integer literals, only converting strings to integers (not floats) inside filters.

The Date Filter

The built-in date filter uses dateutil for parsing strings to datetimes, and strftime for formatting. There are likely to be some inconsistencies between this and the reference implementation's equivalent parsing and formatting of dates and times.

Orphaned {% break %} and {% continue %}

See issue #76

Shopify/liquid shows some unintuitive behavior when {% break %} or {% continue %} are found outside a {% for %} tag block.

{%- 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 %}

Shopify/iquid output in both strict and lax modes:

before
hello

Python Liquid raises a LiquidSyntaxError in strict mode and jumps over the entire outer {% if %} block in lax mode.

1

2

3


1

2

3