Replies: 1 comment
-
Observations for shopify/liquid, and decisions in LiquidJS:
To clarify, the following test snippets both render to {{ "aba" | replace : 'a', '"' }}
{{ "aba" | replace : 'a', '\"' }}
{{ "aba" | replace : 'a', "\"" }} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working through a difference in input handling between this and other liquid libraries, specifically wrt string literals, in this example:
These two string literals are interpreted by JS as
["'", "\"", "'"]
aka single quote, escaped double quote, single quote in a 3 char string["'", "\\", "\"", "'"]
aka single quote, escaped backslash, escaped quote, single quote in a 4 char stringthe two pieces are parsed by
parseStringLiteral
excerpt, my read of this is that we skip the first char being the quote (!) and then treat proceeding escape chars the same whether the string literal uses single or double quotes, to do escaping as expected there should be two paths a single quote path and a double quote path? If started with single quote, then\"
is two chars, if started with double quote then\"
is one char (escaped quote).This has the impact in my simple example of making the replace filter never fire, as the parseStringLiteral method considers these two strings equivalent.
Beta Was this translation helpful? Give feedback.
All reactions