Fix tags in comment

This commit is contained in:
Peter Zhu
2020-11-06 12:08:53 -05:00
parent c7c21e88f0
commit d1a08eacfe
2 changed files with 3 additions and 1 deletions

View File

@@ -114,7 +114,7 @@ module Liquid
when token.start_with?(TAGSTART)
whitespace_handler(token, parse_context)
unless token =~ FullToken
BlockBody.raise_missing_tag_terminator(token, parse_context)
return yield token, token
end
tag_name = Regexp.last_match(2)
markup = Regexp.last_match(4)

View File

@@ -36,6 +36,8 @@ class StandardTagTest < Minitest::Test
assert_template_result('', '{%comment%}{% endif %}{%endcomment%}')
assert_template_result('', '{% comment %}{% endwhatever %}{% endcomment %}')
assert_template_result('', '{% comment %}{% raw %} {{%%%%}} }} { {% endcomment %} {% comment {% endraw %} {% endcomment %}')
assert_template_result('', '{% comment %}{% " %}{% endcomment %}')
assert_template_result('', '{% comment %}{%%}{% endcomment %}')
assert_template_result('foobar', 'foo{%comment%}comment{%endcomment%}bar')
assert_template_result('foobar', 'foo{% comment %}comment{% endcomment %}bar')