Skip to content

Commit

Permalink
Require a space after the inline comment tag name (i.e. after #)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanahsmith committed Feb 24, 2021
1 parent 5e8e5e8 commit d889127
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/liquid/block_body.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

module Liquid
class BlockBody
LiquidTagToken = /\A\s*(\w+|#)\s*(.*?)\z/o
FullToken = /\A#{TagStart}#{WhitespaceControl}?(\s*)(\w+|#)(\s*)(.*?)#{WhitespaceControl}?#{TagEnd}\z/om
LiquidTagToken = /\A\s*([\w#]+)\s*(.*?)\z/o
FullToken = /\A#{TagStart}#{WhitespaceControl}?(\s*)([\w#]+)(\s*)(.*?)#{WhitespaceControl}?#{TagEnd}\z/om
ContentOfVariable = /\A#{VariableStart}#{WhitespaceControl}?(.*?)#{WhitespaceControl}?#{VariableEnd}\z/om
WhitespaceOrNothing = /\A\s*\z/
TAGSTART = "{%"
Expand Down
4 changes: 2 additions & 2 deletions test/integration/tags/inline_comment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_inside_liquid_tag
end

def test_no_space_after_hash_symbol
assert_template_result('', '{% #immediate text %}')
assert_template_result('', '{% liquid #immediate text %}')
assert_match_syntax_error(/Unknown tag '#immediate'/, '{% #immediate text %}')
assert_match_syntax_error(/Unknown tag '#immediate'/, '{% liquid #immediate text %}')
end
end

0 comments on commit d889127

Please sign in to comment.