From e4c4c45ce46309509ae180d1618b5646e5ddd41f Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 17 Sep 2024 18:10:35 +0800 Subject: [PATCH] chore: update tag matcher --- parser/tag.go | 2 +- parser/tests/tag_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/parser/tag.go b/parser/tag.go index 1f8f9c7..450810f 100644 --- a/parser/tag.go +++ b/parser/tag.go @@ -22,7 +22,7 @@ func (*TagParser) Match(tokens []*tokenizer.Token) (ast.Node, int) { contentTokens := []*tokenizer.Token{} for _, token := range matchedTokens[1:] { - if token.Type == tokenizer.Space || token.Type == tokenizer.PoundSign { + if token.Type == tokenizer.Space || token.Type == tokenizer.PoundSign || token.Type == tokenizer.Backslash { break } contentTokens = append(contentTokens, token) diff --git a/parser/tests/tag_test.go b/parser/tests/tag_test.go index eab6cf5..725ebf5 100644 --- a/parser/tests/tag_test.go +++ b/parser/tests/tag_test.go @@ -34,6 +34,12 @@ func TestTagParser(t *testing.T) { Content: "tag/subtag", }, }, + { + text: `#tag\'s 123`, + node: &ast.Tag{ + Content: "tag", + }, + }, } for _, test := range tests {