aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup/mdstripper
diff options
context:
space:
mode:
Diffstat (limited to 'modules/markup/mdstripper')
-rw-r--r--modules/markup/mdstripper/mdstripper.go12
-rw-r--r--modules/markup/mdstripper/mdstripper_test.go4
2 files changed, 8 insertions, 8 deletions
diff --git a/modules/markup/mdstripper/mdstripper.go b/modules/markup/mdstripper/mdstripper.go
index fe0eabb473..5a6504416a 100644
--- a/modules/markup/mdstripper/mdstripper.go
+++ b/modules/markup/mdstripper/mdstripper.go
@@ -46,7 +46,7 @@ func (r *stripRenderer) Render(w io.Writer, source []byte, doc ast.Node) error {
coalesce := prevSibIsText
r.processString(
w,
- v.Text(source), //nolint:staticcheck
+ v.Text(source), //nolint:staticcheck // Text is deprecated
coalesce)
if v.SoftLineBreak() {
r.doubleSpace(w)
@@ -91,8 +91,7 @@ func (r *stripRenderer) processAutoLink(w io.Writer, link []byte) {
}
// Note: we're not attempting to match the URL scheme (http/https)
- host := strings.ToLower(u.Host)
- if host != "" && host != strings.ToLower(r.localhost.Host) {
+ if u.Host != "" && !strings.EqualFold(u.Host, r.localhost.Host) {
// Process out of band
r.links = append(r.links, linkStr)
return
@@ -107,11 +106,12 @@ func (r *stripRenderer) processAutoLink(w io.Writer, link []byte) {
}
var sep string
- if parts[3] == "issues" {
+ switch parts[3] {
+ case "issues":
sep = "#"
- } else if parts[3] == "pulls" {
+ case "pulls":
sep = "!"
- } else {
+ default:
// Process out of band
r.links = append(r.links, linkStr)
return
diff --git a/modules/markup/mdstripper/mdstripper_test.go b/modules/markup/mdstripper/mdstripper_test.go
index ea34df0a3b..7fb49c1e01 100644
--- a/modules/markup/mdstripper/mdstripper_test.go
+++ b/modules/markup/mdstripper/mdstripper_test.go
@@ -79,7 +79,7 @@ A HIDDEN ` + "`" + `GHOST` + "`" + ` IN THIS LINE.
lines = append(lines, line)
}
}
- assert.EqualValues(t, test.expectedText, lines)
- assert.EqualValues(t, test.expectedLinks, links)
+ assert.Equal(t, test.expectedText, lines)
+ assert.Equal(t, test.expectedLinks, links)
}
}