Compare commits

...
Author SHA1 Message Date
Michael Go fc474307f6 add quirky raw tag parsing 2023-07-06 17:32:00 -03:00
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -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}#{WhitespaceControl}?\s*(\w+)\s*(.*)?#{WhitespaceControl}?#{TagEnd}\z/om
FullTokenPossiblyInvalid = /\A(.*)#{TagStart}#{WhitespaceControl}?[^\w\d]*(\w+)[^\w\d]*(.*)?#{WhitespaceControl}?#{TagEnd}\z/om
def initialize(tag_name, markup, parse_context)
super
+12
View File
@@ -131,4 +131,16 @@ class ParsingQuirksTest < Minitest::Test
def test_contains_in_id
assert_template_result(' YES ', '{% if containsallshipments == true %} YES {% endif %}', { 'containsallshipments' => true })
end
def test_delimiter_can_have_characters_after
assert_template_result('123', "{% if true %}123{% endif this is a valid syntax %}")
end
def test_none_breaking_whitespaces_in_tag
assert_template_result('123', "{% raw %}123{%\u{00A0}endraw\u{00A0}%}")
assert_template_result('123', "{% raw %}123{%\u{2000}endraw%}")
assert_template_result('123', "{% raw %}123{%endraw\u{200B}%}")
end
end # ParsingQuirksTest