Skip to content

Commit

Permalink
Fix fullwidth to remove ; for fix invalid convert with HTML Entity …
Browse files Browse the repository at this point in the history
…case.
  • Loading branch information
huacnlee committed Dec 25, 2020
1 parent f5c5e96 commit d528a09
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fullwidth.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
}

spcialPunctuations = `[.:]`
normalPunctuations = `[,;\!\?~]`
normalPunctuations = `[,\!\?~]`

punctuationWithLeftCJKRe = regexp.MustCompile(normalPunctuations + `[` + cjk + `]+`)
punctuationWithRightCJKRe = regexp.MustCompile(`[` + cjk + `]+` + normalPunctuations)
Expand Down
2 changes: 2 additions & 0 deletions fullwidth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ func Test_fullwidth(t *testing.T) {
"蚂蚁疾奔:蚂蚁集团两地上市~全速推进!": "蚂蚁疾奔:蚂蚁集团两地上市~全速推进!",
"蚂蚁集团是阿里巴巴(BABA.N)旗下金融科技子公司": "蚂蚁集团是阿里巴巴 (BABA.N) 旗下金融科技子公司",
"Dollar的演示 $阿里巴巴.US$ 股票标签": "Dollar 的演示 $阿里巴巴.US$ 股票标签",
// https://developer.mozilla.org/en-US/docs/Glossary/Entity
"确保">HTML Entity<"的字符"不会被处理" Ruby&Go": "确保">HTML Entity<"的字符"不会被处理" Ruby&Go",
}

for source, exptected := range cases {
Expand Down

0 comments on commit d528a09

Please sign in to comment.