liquid-spec main changed the adapter API:
- compile block now receives (ctx, source, options) and should store
the template in ctx[:template]
- render block now receives (ctx, assigns, options) and retrieves
the template from ctx[:template]
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Solves Shopify/theme-check#582
`icon` should be visited in the render tag for the following snippet:
```liquid
{% assign icon = 'warning' }
{% render 'icon' with icon %}
```
This commit adds a new tag named `#` that behaves like a comment.
Therefore it behaves as you'd expect any tag would work. The difference
with the comment tag is that the comment is in the tag markup and that
there is no block delimiter.
What it looks like in practice:
```liquid
{%- # this is an inline comment -%}
{% # this too is an inline comment %}
{% liquid
# required args:
assign product = product
# optional args:
assign should_show_border = should_show_border | default: true
assign should_show_cursor = should_show_cursor | default: true
%}
{% liquid
# This is a very long comment that spans multiple lines.
# It looks very similar to what it would look like if you wrote
# ruby code instead of liquid. But it doesn't have all the clunk
# of having an open tag and a close tag with so many characters.
%}
```
Co-authored-by: Dylan Thacker-Smith <[email protected]>
Liquid::C parses liquid filter arguments with dashes in them, Liquid does not.
For tags that accept kwargs and dumps them on the HTML tag, this is an important feature.
e.g. {{ ... | image_tag: loading: 'lazy', data-something: 'value!' }}
Without this change, Liquid would incorrectly parse the
`data-something` kwarg as a single argument and would skip over the
invalid characters.
See https://github.com/Shopify/theme-check/issues/539 for more context
This fixes theme-check#218, wherein variables used in echo tags are not
considered used by the linter. It is because our visitor doesn't see the
:variable_lookup's in the echo tag since the children array is empty.
But this array is empty because it is swallowed by the @variable.