close
Skip to content

Support or operator in case/when tags #123

@TheLastZombie

Description

@TheLastZombie

Checklist

  • I have searched the issue list
  • I have tested my example against Shopify Liquid. (This isn't necessary if the actual behavior is a panic, or an error for which IsTemplateError returns false.)

Expected Behavior

The following Liquid template:

{% case 1 %}{% when 1 or 2 %}{% endcase %}

Throws an error:

Liquid error: syntax error in "{%when 1 or 2" in {% case 1 %}

Actual Behavior

There should not be an error and the result should be the same as parsing the following template:

{% case 1 %}{% when 1, 2 %}{% endcase %}

Detailed Description

According to the Liquid documentation, there are two ways to separate multiple values with the same expression in a case tag:

Provide the values as a comma-separated list, or separate them using an or operator.

This package already supports the former, but the latter throws an error (see above or Go Playground example).

Possible Solution

The when tag parser would have to treat or in the same way as , .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions