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:
output
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.
Error Handling
Python Liquid might not handle syntax or type errors in the same way as the reference implementation. We might fail earlier or later, and will almost certainly produce a different error message.
Python Liquid does not have a "lax" parser, like Ruby Liquid. If the lexer encounters unknown symbols, a LiquidSyntaxError is raised. Upon finding an error in lax mode, the parser simply discards the current block and continues to to the next block, if one is available. Also, Python Liquid will never inject error messages into an output document.
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:
Python Liquid raises a LiquidSyntaxError in strict mode and jumps over the entire outer {% if %} block in lax mode.