Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Prettier Liquid: Filters #45

Closed
Tracked by #5
charlespwd opened this issue Aug 3, 2022 · 0 comments · Fixed by #46
Closed
Tracked by #5

Prettier Liquid: Filters #45

charlespwd opened this issue Aug 3, 2022 · 0 comments · Fixed by #46
Assignees

Comments

@charlespwd
Copy link
Collaborator

charlespwd commented Aug 3, 2022

Followup to #41

We should now parse filters, their syntax and print them properly.

{% # positional args %}
{{ x | filter: arg1, arg2, arg3 }}

{% # kwargs %}
{{ x | filter: name: value, other: value }}

{% # mix %}
{{ x | filter: arg1, loading: "lazy" }}

As well as define how we handle long lines. According to #12 and #13—if the line must break—we want the following:

  • pipe first
  • first argument same line (only positional)
  • liquid drop variable expression same line

That means we expect the following (with printWidth: 1):

{{ product
  | filter: arg1,
    arg2,
    arg3
  | filter2:
    key1: val1,
    key2: val2
}}

{% # I think I'd prefer this one but it feels like community prefers the above %}
{{ 
  product
  | filter: arg1,
    arg2,
    arg3
  | filter2:
    key1: val1,
    key2: val2
}}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant