liquid
liquid copied to clipboard
Bracketed identifier parsing with and without dots
Python liquid will successfully parse a chained identifier containing a bracketed index or identifier, followed immediately by another identifier, with no separating dot.
{{ products[0]title }}
Ruby Liquid will raise a Liquid::SyntaxError
when parsing the above template, instead expecting {{ products[0].title }}
. Python Liquid will accept either without error.
Similarly, Python Liquid will handle {{ products.[0].title }}
, while Ruby Liquid will again raise a Liquid::SyntaxError
.
Related, Python Liquid will parse {{ products.0.title }}
and {{ products[0].title }}
. Ruby Liquid only accepts the later, raising a Liquid::SyntaxError
for the former, whether in strict mode or not.
And, with the initial example of {{ products[0]title }}
, Ruby Liquid only raise an exception in strict mode. Lax mode does parse it successfully.