We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
github.com/osteele/liquid v1.2.4
go version go1.13.7 darwin/amd64
I am receiving syntax errors while trying to parse templates that are meant for shopify. I have filters that look like this
{{image | img_url: '580x', scale: 2}} {{ order.created_at | date: format: 'date' }} {{ 'customer.order.title' | t: name: order.name }}
I have tried to just define the filters:
cfg.AddFilter("t", func(value interface{}) interface{} { return value }) cfg.AddFilter("date", func(value interface{}) interface{} { return value })
And I get a generic Syntax error that does not define what the error is.
Here is a test that will reproduce this:
package lint import ( "testing" "github.com/osteele/liquid" "github.com/stretchr/testify/assert" ) func TestPathToProject(t *testing.T) { engine := liquid.NewEngine() template := `{{ 'customer.order.title' | t: name: order.name }}` bindings := map[string]interface{}{} engine.RegisterFilter("t", func(value interface{}) interface{} { return value }) _, err := engine.ParseAndRenderString(template, bindings) assert.Nil(t, err) }
I have a hunch that you do not support named arguments to filters.
Follow-up question, it does not seem like your for loop supports else and I cannot seem to override the standard for loop with my own
else
The text was updated successfully, but these errors were encountered:
That is correct, this library does not support named arguments to filters. (In fact, I did not know that Shopify did.)
I would be interested in having a fix for this, but I don't promise to find time to write one.
Sorry, something went wrong.
for
Here is documentation for Shopify's image_url parameters: https://shopify.dev/api/liquid/filters/url-filters#other-image-url-parameters
image_url
Here is a test case for filter parameters in the Ruby implementation's parser: https://github.com/Shopify/liquid/blob/9b8e3d437e1ac461fc32bd896e7f35dfa8b94a2a/test/unit/parser_unit_test.rb#L73 (from this bug report against the C implementation — which I just learned exists)
I appear to have come across these issues too.
No branches or pull requests
System information
github.com/osteele/liquid v1.2.4
go version go1.13.7 darwin/amd64
Problem
I am receiving syntax errors while trying to parse templates that are meant for shopify. I have filters that look like this
I have tried to just define the filters:
And I get a generic Syntax error that does not define what the error is.
Steps to reproduce the behavior
Here is a test that will reproduce this:
Possible Solution
I have a hunch that you do not support named arguments to filters.
Follow-up question, it does not seem like your for loop supports
else
and I cannot seem to override the standard for loop with my ownThe text was updated successfully, but these errors were encountered: