Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/liquid/tags/raw.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def initialize(tag_name, markup, parse_context)
def parse(tokens)
@body = ''
while token = tokens.shift
if token =~ FullTokenPossiblyInvalid
if token =~ FullTokenPossiblyInvalid and block_delimiter == $2
@body << $1 if $1 != "".freeze
return if block_delimiter == $2
return
end
@body << token unless token.empty?
end
Expand Down
4 changes: 4 additions & 0 deletions test/integration/tags/raw_tag_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ def test_open_tag_in_raw
assert_template_result ' Foobar {{ invalid 1', '{% raw %} Foobar {{ invalid {% endraw %}{{ 1 }}'
end

def test_nested_tag_in_raw
assert_template_result '{{ {% test %} }}', '{% raw %}{{ {% test %} }}{% endraw %}'
end

def test_invalid_raw
assert_match_syntax_error(/tag was never closed/, '{% raw %} foo')
assert_match_syntax_error(/Valid syntax/, '{% raw } foo {% endraw %}')
Expand Down