parent
87997cccbb
commit
798fdeae45
1 changed files with 12 additions and 10 deletions
|
@ -632,16 +632,18 @@ func shortLinkProcessorFull(ctx *postProcessCtx, node *html.Node, noLink bool) {
|
||||||
// When parsing HTML, x/net/html will change all quotes which are
|
// When parsing HTML, x/net/html will change all quotes which are
|
||||||
// not used for syntax into UTF-8 quotes. So checking val[0] won't
|
// not used for syntax into UTF-8 quotes. So checking val[0] won't
|
||||||
// be enough, since that only checks a single byte.
|
// be enough, since that only checks a single byte.
|
||||||
if (strings.HasPrefix(val, "“") && strings.HasSuffix(val, "”")) ||
|
if len(val) > 1 {
|
||||||
(strings.HasPrefix(val, "‘") && strings.HasSuffix(val, "’")) {
|
if (strings.HasPrefix(val, "“") && strings.HasSuffix(val, "”")) ||
|
||||||
const lenQuote = len("‘")
|
(strings.HasPrefix(val, "‘") && strings.HasSuffix(val, "’")) {
|
||||||
val = val[lenQuote : len(val)-lenQuote]
|
const lenQuote = len("‘")
|
||||||
} else if (strings.HasPrefix(val, "\"") && strings.HasSuffix(val, "\"")) ||
|
val = val[lenQuote : len(val)-lenQuote]
|
||||||
(strings.HasPrefix(val, "'") && strings.HasSuffix(val, "'")) {
|
} else if (strings.HasPrefix(val, "\"") && strings.HasSuffix(val, "\"")) ||
|
||||||
val = val[1 : len(val)-1]
|
(strings.HasPrefix(val, "'") && strings.HasSuffix(val, "'")) {
|
||||||
} else if strings.HasPrefix(val, "'") && strings.HasSuffix(val, "’") {
|
val = val[1 : len(val)-1]
|
||||||
const lenQuote = len("‘")
|
} else if strings.HasPrefix(val, "'") && strings.HasSuffix(val, "’") {
|
||||||
val = val[1 : len(val)-lenQuote]
|
const lenQuote = len("‘")
|
||||||
|
val = val[1 : len(val)-lenQuote]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
props[key] = val
|
props[key] = val
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue