markup/goldmark: Simplify code
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 4 Jan 2020 22:58:23 +0000 (23:58 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 4 Jan 2020 22:58:23 +0000 (23:58 +0100)
markup/goldmark/autoid.go

index 6599f08d9318ce4492b50f6f1c7788052dbdf681..c064a76b3d2b32ca7ee3f8df37f73d27e0af3a28 100644 (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:
                }