Permalink
Browse files

Accept hyphen and plus sign in emoji detection

Fixes #5635
  • Loading branch information...
anthonyfok committed Jan 29, 2019
1 parent 526b5b1 commit 3038464ea6f931c8a08ee49d47f1eaec99ba4817
Showing with 1 addition and 1 deletion.
  1. +1 −1 parser/pageparser/pagelexer.go
@@ -223,7 +223,7 @@ func lexEmoji(l *pageLexer) stateFunc {
break
}
r, _ := utf8.DecodeRune(l.input[i:])
if !isAlphaNumeric(r) {

This comment has been minimized.

@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.

@anthonyfok

anthonyfok Jan 29, 2019

Author Contributor

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.

if !(isAlphaNumericOrHyphen(r) || r == '+') {
break
}
}

0 comments on commit 3038464

Please sign in to comment.