Port liquid-c bug compatible whitespace trimming (#1291)

This commit is contained in:
Dylan Thacker-Smith
2020-09-16 16:07:36 -04:00
committed by GitHub
parent 77084930e9
commit ca4b9b43af
2 changed files with 32 additions and 0 deletions
+4
View File
@@ -145,7 +145,11 @@ module Liquid
if token[2] == WhitespaceControl
previous_token = @nodelist.last
if previous_token.is_a?(String)
first_byte = previous_token.getbyte(0)
previous_token.rstrip!
if previous_token.empty? && parse_context[:bug_compatible_whitespace_trimming] && first_byte
previous_token << first_byte
end
end
end
parse_context.trim_whitespace = (token[-3] == WhitespaceControl)