commit 5ee1f0876f3ec8b79d6305298185dc821ead2d28
parent a82d2700fcc772aada15d65b8f76913ca23f7404
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Sat, 4 Jan 2020 23:58:23 +0100
markup/goldmark: Simplify code
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/markup/goldmark/autoid.go b/markup/goldmark/autoid.go
@@ -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:
}