Replies: 2 comments
-
The top level syntax should be Liquid, that means the template passed into LiquidJS should be a valid Liquid template string. In this case the above string has a {% assign cf = location.tags | where: \"name\",\"Market\" | first %} Note that the quotes are escaped (that's valid in JSON syntax, but not in Liquid syntax). |
Beta Was this translation helpful? Give feedback.
0 replies
-
I solved this problem this way, but I'm sure there is a better solution: template = template.replace(/\{\{.*?\}\}/g, (match) => {
return match.includes('\\"') ? JSON.parse(`"${match}"` : match
}); |
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.
-
Hi there!
Im looking for help :)
So I have a mongo document storing liquid markup expressions
"settings" : { "src" : "{{location.name}}", "href" : "visit us: {% if location.website !='' %}{{location.website}}{%else%}{{location.url}}{% endif %}", "exp" : "{% assign cf = location.tags | where: \"name\",\"Market\" | first %}{{cf.data}}" },
When i stringify the whole node and try to parse it, im getting ""Error: tag "{% assign cf ..." not closed, probably related to the escape im doing for storing the expression on db
Any ideas about how could i get it working? If i process each key-val separately it works just fine
Thanks in advance
Ale
Beta Was this translation helpful? Give feedback.
All reactions