-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't parse nodes inside a comment tag #1755
Conversation
cf773ee
to
8d65f2b
Compare
Co-authored-by: Alex Coco <[email protected]>
8d65f2b
to
dbf0aa8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this is within the scope of this PR, but a broken tag inside of the comment still fails.
require "liquid"
template = Liquid::Template.parse(<<~LIQUID)
{% comment %}
{% assign foo = "123"
{% endcomment %}
{{ foo}}
LIQUID
Co-authored-by: Peter Zhu <[email protected]>
@peterzhu2118 Ah... great catch! |
afa5f26
to
e180535
Compare
63e1865
to
41f6517
Compare
depends on Shopify/liquid-c#209
What are you trying to solve?
Liquid Tags inside a
comment
tag are getting parsed, and any Liquid tags are required to be valid.Because of this parsing behaviour, the Liquid codes inside the comment tag has to be valid.
A known workaround of this issue is using a
raw
tag inside the comment tag:How are you solving this?
This PR updates the
comment
tag to only consume the tokens without creating child nodes.This change will improve the
comment
tag's Template parsing speed, and allow developers to have incomplete code inside thecomment
tag.Legacy Support
Inside a
comment
tag, childrencomment
tag andraw
tags will have be valid and closed.This
comment
tag inside a comment will have to be closed because{% endcomment %}
tag delimiters needs to be balanced. (Closing the firstcomment
tag in line 4 will result a syntax error)This
raw
tag inside a comment will have to be closed because{% endcomment %}
inside araw
tag has been ignored: