diff --git a/fun.go b/fun.go index 6783173..e958600 100644 --- a/fun.go +++ b/fun.go @@ -220,6 +220,7 @@ func translate(honk *Honk, redoimages bool) { n, _ := htf.String(honk.Noise) honk.Precis = string(p) honk.Noise = string(n) + honk.Noise = strings.Replace(honk.Noise, "%s`, p, serverName, + return fmt.Sprintf(`%s%s`, p, serverName, strings.ToLower(h[1:]), h) }) return s diff --git a/markitzero.go b/markitzero.go index d954d20..5611e50 100644 --- a/markitzero.go +++ b/markitzero.go @@ -73,7 +73,7 @@ func markitzero(s string) string { // mark it zero s = re_link.ReplaceAllStringFunc(s, linkreplacer) - s = re_zerolink.ReplaceAllString(s, `$1`) + s = re_zerolink.ReplaceAllString(s, `$1`) s = re_bolder.ReplaceAllString(s, "$1$2$3") s = re_italicer.ReplaceAllString(s, "$1$2$3") s = re_quoter.ReplaceAllString(s, "
$1
") @@ -128,7 +128,7 @@ func linkreplacer(url string) string { url = url[:len(url)-1] adddot = true } - url = fmt.Sprintf(`%s`, url, url) + url = fmt.Sprintf(`%s`, url, url) if adddot { url += "." } diff --git a/markitzero_test.go b/markitzero_test.go index 7c7b7ca..541fc5a 100644 --- a/markitzero_test.go +++ b/markitzero_test.go @@ -13,7 +13,7 @@ func doonezerotest(t *testing.T, input, output string) { func TestBasictest(t *testing.T) { input := `link to https://example.com/ with **bold** text` - output := `link to https://example.com/ with bold text` + output := `link to https://example.com/ with bold text` doonezerotest(t, input, output) } @@ -49,48 +49,48 @@ func TestCodeStyles(t *testing.T) { func TestSimplelink(t *testing.T) { input := "This is a [link](https://example.com)." - output := `This is a link.` + output := `This is a link.` doonezerotest(t, input, output) } func TestSimplelink2(t *testing.T) { input := "See (http://example.com) for examples." - output := `See (http://example.com) for examples.` + output := `See (http://example.com) for examples.` doonezerotest(t, input, output) } func TestWikilink(t *testing.T) { input := "I watched [Hackers](https://en.wikipedia.org/wiki/Hackers_(film))" - output := `I watched Hackers` + output := `I watched Hackers` doonezerotest(t, input, output) } func TestQuotedlink(t *testing.T) { input := `quoted "https://example.com/link" here` - output := `quoted "https://example.com/link" here` + output := `quoted "https://example.com/link" here` doonezerotest(t, input, output) } func TestLinkinQuote(t *testing.T) { input := `> a quote and https://example.com/link` - output := `
a quote and https://example.com/link
` + output := `
a quote and https://example.com/link
` doonezerotest(t, input, output) } func TestBoldLink(t *testing.T) { input := `**b https://example.com/link b**` - output := `b https://example.com/link b` + output := `b https://example.com/link b` doonezerotest(t, input, output) } func TestHonklink(t *testing.T) { input := `https://en.wikipedia.org/wiki/Honk!` - output := `https://en.wikipedia.org/wiki/Honk!` + output := `https://en.wikipedia.org/wiki/Honk!` doonezerotest(t, input, output) } func TestImagelink(t *testing.T) { input := `an image and linked [](example.com)` - output := `an image and linked ` + output := `an image and linked ` doonezerotest(t, input, output) }