Address comments

This commit is contained in:
Peter Zhu
2020-10-26 16:16:30 -04:00
parent 0bedc71854
commit 5c082472a1
5 changed files with 19 additions and 15 deletions
+4 -14
View File
@@ -11,7 +11,7 @@ module Liquid
def parse(tokens)
@body = new_body
while parse_body(@body, tokens, partial: true)
while parse_body(@body, tokens)
end
@body.freeze
end
@@ -68,9 +68,7 @@ module Liquid
end
# @api public
def parse_body(body, tokens, partial: false)
block_terminated = true
def parse_body(body, tokens)
if parse_context.depth >= MAX_DEPTH
raise StackLevelError, "Nesting too deep"
end
@@ -79,10 +77,7 @@ module Liquid
body.parse(tokens, parse_context) do |end_tag_name, end_tag_params|
@blank &&= body.blank?
if end_tag_name == block_delimiter
block_terminated = false
next
end
return false if end_tag_name == block_delimiter
raise_tag_never_closed(block_name) unless end_tag_name
# this tag is not registered with the system
@@ -93,12 +88,7 @@ module Liquid
parse_context.depth -= 1
end
unless partial
body.remove_blank_strings if body.blank?
body.freeze
end
block_terminated
true
end
end
end