From 74e505f6fa366767cd998ccbeadea61c1b29a69c Mon Sep 17 00:00:00 2001 From: Marco Concetto Rudilosso Date: Wed, 1 Feb 2023 13:49:51 +0000 Subject: [PATCH 1/2] Allow raw tag to be used with whitespace control --- lib/liquid/tags/raw.rb | 2 +- test/integration/tags/raw_tag_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/liquid/tags/raw.rb b/lib/liquid/tags/raw.rb index 6ffb6149..947398b0 100644 --- a/lib/liquid/tags/raw.rb +++ b/lib/liquid/tags/raw.rb @@ -14,7 +14,7 @@ module Liquid # @liquid_syntax_keyword expression The expression to be output without being rendered. class Raw < Block Syntax = /\A\s*\z/ - FullTokenPossiblyInvalid = /\A(.*)#{TagStart}\s*(\w+)\s*(.*)?#{TagEnd}\z/om + FullTokenPossiblyInvalid = /\A(.*)#{TagStart}#{WhitespaceControl}?\s*(\w+)\s*(.*)?#{WhitespaceControl}?#{TagEnd}\z/om def initialize(tag_name, markup, parse_context) super diff --git a/test/integration/tags/raw_tag_test.rb b/test/integration/tags/raw_tag_test.rb index 7ac0b09c..1aa9bdd2 100644 --- a/test/integration/tags/raw_tag_test.rb +++ b/test/integration/tags/raw_tag_test.rb @@ -12,6 +12,7 @@ class RawTagTest < Minitest::Test def test_output_in_raw assert_template_result('{{ test }}', '{% raw %}{{ test }}{% endraw %}') + assert_template_result('{{ test }}', '{%- raw -%}{{ test }}{%- endraw -%}') end def test_open_tag_in_raw From ddc32b7bd8f28e709208245d5fd6a668792f8a48 Mon Sep 17 00:00:00 2001 From: Marco Concetto Rudilosso Date: Wed, 1 Feb 2023 15:52:34 +0000 Subject: [PATCH 2/2] actually test whitespace stripping --- test/integration/tags/raw_tag_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/tags/raw_tag_test.rb b/test/integration/tags/raw_tag_test.rb index 1aa9bdd2..6d395b5b 100644 --- a/test/integration/tags/raw_tag_test.rb +++ b/test/integration/tags/raw_tag_test.rb @@ -11,8 +11,8 @@ 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('{{ test }}', '{% raw %}{{ test }}{% endraw %}') + assert_template_result('>{{ test }}<', '> {%- raw -%}{{ test }}{%- endraw -%} <') end def test_open_tag_in_raw