Closed ggmichaelgo closed 10 months ago
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
@peterzhu2118 Ah... great catch! That should be a valid template, and I will update the PR to allow templates like that :)
depends on https://github.com/Shopify/liquid-c/pull/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: