From d1a08eacfe109ef74f638ec8c0c9e81331f4a8b8 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 6 Nov 2020 12:08:53 -0500 Subject: [PATCH] Fix tags in comment --- lib/liquid/block_body.rb | 2 +- test/integration/tags/standard_tag_test.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/liquid/block_body.rb b/lib/liquid/block_body.rb index af62a14..b7fb47b 100644 --- a/lib/liquid/block_body.rb +++ b/lib/liquid/block_body.rb @@ -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) diff --git a/test/integration/tags/standard_tag_test.rb b/test/integration/tags/standard_tag_test.rb index ea7dca1..d7c0316 100644 --- a/test/integration/tags/standard_tag_test.rb +++ b/test/integration/tags/standard_tag_test.rb @@ -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')