Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow raw tag to be used with whitespace control #1683

Merged
merged 2 commits into from Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/liquid/tags/raw.rb
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/integration/tags/raw_tag_test.rb
Expand Up @@ -12,6 +12,7 @@ def test_tag_in_raw

def test_output_in_raw
assert_template_result('{{ test }}', '{% raw %}{{ test }}{% endraw %}')
assert_template_result('{{ test }}', '{%- raw -%}{{ test }}{%- endraw -%}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't actually test the effect of the whitespace control characters. We don't want to support whitespace control characters if they don't actually strip text. E.g. I would expect

Suggested change
assert_template_result('{{ test }}', '{%- raw -%}{{ test }}{%- endraw -%}')
assert_template_result('>{{ test }}<', '> {%- raw -%} {{ test }} {%- endraw -%} <')

end

def test_open_tag_in_raw
Expand Down