mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
Merge pull request #1773 from Shopify/liquid-tag-whitespace-control-with-comment
don't reset Liquid tag's whitespace control from comment tag
This commit is contained in:
@@ -61,11 +61,11 @@ module Liquid
|
|||||||
comment_tag_depth += 1
|
comment_tag_depth += 1
|
||||||
when "endcomment"
|
when "endcomment"
|
||||||
comment_tag_depth -= 1
|
comment_tag_depth -= 1
|
||||||
|
end
|
||||||
|
|
||||||
if comment_tag_depth.zero?
|
if comment_tag_depth.zero?
|
||||||
parse_context.trim_whitespace = (token[-3] == WhitespaceControl)
|
parse_context.trim_whitespace = (token[-3] == WhitespaceControl) unless tokenizer.for_liquid_tag
|
||||||
return false
|
return false
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -187,4 +187,16 @@ class CommentTagUnitTest < Minitest::Test
|
|||||||
Hello!
|
Hello!
|
||||||
LIQUID
|
LIQUID
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_dont_override_liquid_tag_whitespace_control
|
||||||
|
assert_template_result("Hello!World!", <<~LIQUID.chomp)
|
||||||
|
Hello!
|
||||||
|
{%- liquid
|
||||||
|
comment
|
||||||
|
this is inside a liquid tag
|
||||||
|
endcomment
|
||||||
|
-%}
|
||||||
|
World!
|
||||||
|
LIQUID
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user