Skip to content

Commit

Permalink
Accept hyphen and plus sign in emoji detection
Browse files Browse the repository at this point in the history
Fixes #5635
  • Loading branch information
anthonyfok committed Jan 29, 2019
1 parent 526b5b1 commit 3038464
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parser/pageparser/pagelexer.go
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func lexEmoji(l *pageLexer) stateFunc {
break break
} }
r, _ := utf8.DecodeRune(l.input[i:]) r, _ := utf8.DecodeRune(l.input[i:])
if !isAlphaNumeric(r) { if !(isAlphaNumericOrHyphen(r) || r == '+') {

This comment has been minimized.

Copy link
@bep

bep Jan 29, 2019

Member

So, one reason why this broke in the first place was a missing test. This fix just waits for it to be broken again. I suggest you expand on the test in hugolib and create some content from the entire emoj map and verify that the result "looks like only emojs" (i.e. have no ":" in it).

This comment has been minimized.

Copy link
@anthonyfok

anthonyfok Jan 29, 2019

Author Member

Thanks for the suggestion! I expanded TestPageWithEmoji to cover +, - and _ in commit 2a9060a. While it is not the entire emoji map, it does cover all types of characters used in the emoji map.

break break
} }
} }
Expand Down

0 comments on commit 3038464

Please sign in to comment.