From 2c0c672df86e2fe7ab554e1d1e4e1653b52e06b7 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 9 Nov 2020 12:34:13 -0500 Subject: [PATCH] Address comments --- lib/liquid/block_body.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/liquid/block_body.rb b/lib/liquid/block_body.rb index b7fb47b0d..c94c2f396 100644 --- a/lib/liquid/block_body.rb +++ b/lib/liquid/block_body.rb @@ -107,14 +107,22 @@ def self.rescue_render_node(context, output, line_number, exc, blank_tag) end end - private def parse_for_document(tokenizer, parse_context) + private def handle_invalid_tag_token(token, parse_context) + if token.end_with?('%}') + yield token, token + else + BlockBody.raise_missing_tag_terminator(token, parse_context) + end + end + + private def parse_for_document(tokenizer, parse_context, &block) while (token = tokenizer.shift) next if token.empty? case when token.start_with?(TAGSTART) whitespace_handler(token, parse_context) unless token =~ FullToken - return yield token, token + return handle_invalid_tag_token(token, parse_context, &block) end tag_name = Regexp.last_match(2) markup = Regexp.last_match(4)