diff --git a/lib/liquid/block_body.rb b/lib/liquid/block_body.rb index a9c002c93..69a29c5e5 100644 --- a/lib/liquid/block_body.rb +++ b/lib/liquid/block_body.rb @@ -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 = "{%" diff --git a/test/integration/tags/inline_comment_test.rb b/test/integration/tags/inline_comment_test.rb index 55db2273d..768c4c69e 100644 --- a/test/integration/tags/inline_comment_test.rb +++ b/test/integration/tags/inline_comment_test.rb @@ -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