markup/goldmark: Simplify code

This commit is contained in:
Bjørn Erik Pedersen 2020-01-04 23:58:23 +01:00
parent a82d2700fc
commit 5ee1f0876f
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -48,9 +48,9 @@ func sanitizeAnchorNameWithHook(b []byte, asciiOnly bool, hook func(buf *bytes.B
r, size := utf8.DecodeRune(b)
switch {
case asciiOnly && size != 1:
case isSpace(r):
buf.WriteString("-")
case r == '-' || isAlphaNumeric(r):
case r == '-' || isSpace(r):
buf.WriteRune('-')
case isAlphaNumeric(r):
buf.WriteRune(unicode.ToLower(r))
default:
}