Skip to content

Commit d889127

Browse files
committed
Require a space after the inline comment tag name (i.e. after #)
1 parent 5e8e5e8 commit d889127

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/liquid/block_body.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
module Liquid
66
class BlockBody
7-
LiquidTagToken = /\A\s*(\w+|#)\s*(.*?)\z/o
8-
FullToken = /\A#{TagStart}#{WhitespaceControl}?(\s*)(\w+|#)(\s*)(.*?)#{WhitespaceControl}?#{TagEnd}\z/om
7+
LiquidTagToken = /\A\s*([\w#]+)\s*(.*?)\z/o
8+
FullToken = /\A#{TagStart}#{WhitespaceControl}?(\s*)([\w#]+)(\s*)(.*?)#{WhitespaceControl}?#{TagEnd}\z/om
99
ContentOfVariable = /\A#{VariableStart}#{WhitespaceControl}?(.*?)#{WhitespaceControl}?#{VariableEnd}\z/om
1010
WhitespaceOrNothing = /\A\s*\z/
1111
TAGSTART = "{%"

test/integration/tags/inline_comment_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_inside_liquid_tag
2121
end
2222

2323
def test_no_space_after_hash_symbol
24-
assert_template_result('', '{% #immediate text %}')
25-
assert_template_result('', '{% liquid #immediate text %}')
24+
assert_match_syntax_error(/Unknown tag '#immediate'/, '{% #immediate text %}')
25+
assert_match_syntax_error(/Unknown tag '#immediate'/, '{% liquid #immediate text %}')
2626
end
2727
end

0 commit comments

Comments
 (0)