mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-16 09:20:42 -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.
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user