Revert "Use strip & empty? to detect Whitespaces"

This reverts commit dd7ed00ec4.
This commit is contained in:
Watson
2022-03-16 12:33:45 +09:00
parent dd7ed00ec4
commit 22568080b1
+3 -2
View File
@@ -7,6 +7,7 @@ module Liquid
LiquidTagToken = /\A\s*(\w+)\s*(.*?)\z/o
FullToken = /\A#{TagStart}#{WhitespaceControl}?(\s*)(\w+)(\s*)(.*?)#{WhitespaceControl}?#{TagEnd}\z/om
ContentOfVariable = /\A#{VariableStart}#{WhitespaceControl}?(.*?)#{WhitespaceControl}?#{VariableEnd}\z/om
WhitespaceOrNothing = /\A\s*\z/
TAGSTART = "{%"
VARSTART = "{{"
@@ -36,7 +37,7 @@ module Liquid
private def parse_for_liquid_tag(tokenizer, parse_context)
while (token = tokenizer.shift)
unless token.strip.empty?
unless token.empty? || token =~ WhitespaceOrNothing
unless token =~ LiquidTagToken
# line isn't empty but didn't match tag syntax, yield and let the
# caller raise a syntax error
@@ -149,7 +150,7 @@ module Liquid
end
parse_context.trim_whitespace = false
@nodelist << token
@blank &&= token.strip.empty?
@blank &&= !!(token =~ WhitespaceOrNothing)
end
parse_context.line_number = tokenizer.line_number
end