mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 09:05:13 -07:00
add quirky raw tag parsing
This commit is contained in:
@@ -14,7 +14,7 @@ module Liquid
|
|||||||
# @liquid_syntax_keyword expression The expression to be output without being rendered.
|
# @liquid_syntax_keyword expression The expression to be output without being rendered.
|
||||||
class Raw < Block
|
class Raw < Block
|
||||||
Syntax = /\A\s*\z/
|
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)
|
def initialize(tag_name, markup, parse_context)
|
||||||
super
|
super
|
||||||
|
|||||||
@@ -131,4 +131,16 @@ class ParsingQuirksTest < Minitest::Test
|
|||||||
def test_contains_in_id
|
def test_contains_in_id
|
||||||
assert_template_result(' YES ', '{% if containsallshipments == true %} YES {% endif %}', { 'containsallshipments' => true })
|
assert_template_result(' YES ', '{% if containsallshipments == true %} YES {% endif %}', { 'containsallshipments' => true })
|
||||||
end
|
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
|
end # ParsingQuirksTest
|
||||||
|
|||||||
Reference in New Issue
Block a user