osteele / liquid

A Liquid template engine in Go
https://godoc.org/github.com/osteele/liquid
MIT License
287 stars 59 forks source link

Syntax error in assign statement #76

Open rom-from-meiro opened 1 year ago

rom-from-meiro commented 1 year ago

Checklist

Expected Behavior

Ability to parse condition assignment in assign tag.

Actual Behavior

syntax error

2023/02/13 13:33:22 Liquid error (line 1): syntax error in "%assign con_0_Euh43 = user.name == \"Ryan\" and user.email == \"xx@gmail.com\"" in {% assign con_0_Euh43 = user.name == "Ryan" and user.email == "xx@gmail.com" %}

Detailed Description

While liquidjs correctly parses it this go implementation not. See https://liquidjs.com/playground.html#eyUgYXNzaWduIGNvbl8wX0V1aDQzID0gdXNlci5uYW1lID09ICJSeWFuIiBhbmQgdXNlci5lbWFpbCA9PSAieHhAZ21haWwuY29tIiAlfSAKeyUgYXNzaWduIGNvbl8xX0V1aDQzID0gdXNlci5wcm9qZWN0ID09ICJFYXN5IGVtYWlsIiAlfSAKe3sgY29uXzBfRXVoNDMgfX0Ke3sgY29uXzFfRXVoNDMgfX0KeyUgaWYgY29uXzBfRXVoNDMgYW5kIGNvbl8xX0V1aDQzICV9CiAgPHA+SGVsbG88L3A+CnslIGVuZGlmICV9,ewogICJ1c2VyIjogewogICAgIm5hbWUiOiAiUnlhbiIsCiAgICAiZW1haWwiOiAieHhAZ21haWwuY29tIiwKICAgICJwcm9qZWN0IjogIkVhc3kgZW1haWwiCiAgfQp9 Even though it can be rewritten to use in if statement directly it is not a solution for because we are using https://github.com/zalify/easy-email which is making these assign statements

Possible Solution

I don't know. But I can help if you direct to somewhere.