From eada2b65a2aad7eb291e10cfdb1242f767c395cc Mon Sep 17 00:00:00 2001 From: Michael Go Date: Wed, 8 Nov 2023 11:13:13 -0400 Subject: [PATCH] clean up comment tag body parsing Co-authored-by: Peter Zhu --- lib/liquid/tags/comment.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/liquid/tags/comment.rb b/lib/liquid/tags/comment.rb index b60ef01b..5c7315e0 100644 --- a/lib/liquid/tags/comment.rb +++ b/lib/liquid/tags/comment.rb @@ -47,16 +47,12 @@ module Liquid tag_name = tag_name_match[2] - if tag_name == "raw" - # raw tags are required to be closed + case tag_name + when "raw" parse_raw_tag_body(tokens) - next - end - - if tag_name_match[2] == "comment" + when "comment" comment_tag_depth += 1 - next - elsif tag_name_match[2] == "endcomment" + when "endcomment" comment_tag_depth -= 1 return false if comment_tag_depth.zero?