From 649cca1349e16f58ef60c6973e3b720bc0630fa1 Mon Sep 17 00:00:00 2001 From: Guillaume Malette Date: Fri, 19 May 2023 11:29:22 -0400 Subject: [PATCH] [trim] Fix trimming at end of raw block when specified in the opening tag --- lib/liquid/tags/raw.rb | 1 + test/integration/tags/raw_tag_test.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/liquid/tags/raw.rb b/lib/liquid/tags/raw.rb index 947398b0..7f3dec9b 100644 --- a/lib/liquid/tags/raw.rb +++ b/lib/liquid/tags/raw.rb @@ -26,6 +26,7 @@ module Liquid @body = +'' while (token = tokens.shift) if token =~ FullTokenPossiblyInvalid && block_delimiter == Regexp.last_match(2) + parse_context.trim_whitespace = (token[-3] == WhitespaceControl) @body << Regexp.last_match(1) if Regexp.last_match(1) != "" return end diff --git a/test/integration/tags/raw_tag_test.rb b/test/integration/tags/raw_tag_test.rb index 7e818129..3629f39c 100644 --- a/test/integration/tags/raw_tag_test.rb +++ b/test/integration/tags/raw_tag_test.rb @@ -13,8 +13,9 @@ class RawTagTest < Minitest::Test end def test_output_in_raw - # assert_template_result('{{ test }}', '{% raw %}{{ test }}{% endraw %}') assert_template_result('>{{ test }}<', '> {%- raw -%}{{ test }}{%- endraw -%} <') + assert_template_result("> inner <", "> {%- raw -%} inner {%- endraw %} <") + assert_template_result("> inner <", "> {%- raw -%} inner {%- endraw -%} <") end def test_open_tag_in_raw