From c21ef99aee6dc29842d3bb1a6db8d55b3e4a7416 Mon Sep 17 00:00:00 2001 From: Eyal Posener Date: Thu, 8 Jul 2021 20:51:53 +0300 Subject: [PATCH] Fix percents in strings Fixes #115 --- internal/markdown/comment.go | 10 +++++----- testdata/pkg12_special_symbols/README.md | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/internal/markdown/comment.go b/internal/markdown/comment.go index bd691c2..4768fe7 100644 --- a/internal/markdown/comment.go +++ b/internal/markdown/comment.go @@ -156,7 +156,7 @@ func emphasize(w io.Writer, line string, words map[string]string, nice bool) { // m >= 6 (two parenthesized sub-regexps in matchRx, 1st one is urlRx) // write text before match - fmt.Fprintf(w, line[0:m[0]]) + fmt.Fprint(w, line[0:m[0]]) // adjust match if necessary match := line[m[0]:m[1]] if n := pairedParensPrefixLen(match); n < len(match) { @@ -197,7 +197,7 @@ func emphasize(w io.Writer, line string, words map[string]string, nice bool) { // Skip Go path ellipsis. if strings.HasSuffix(url, "/...") { - fmt.Fprintf(w, line[1:m[1]]) + fmt.Fprint(w, line[1:m[1]]) line = line[m[1]:] continue } @@ -228,9 +228,9 @@ func emphasize(w io.Writer, line string, words map[string]string, nice bool) { fmt.Fprint(w, "*") } if len(url) > 0 { - fmt.Fprintf(w, url) + fmt.Fprint(w, url) } else { - fmt.Fprintf(w, match) + fmt.Fprint(w, match) } if italics { fmt.Fprint(w, "*") @@ -243,7 +243,7 @@ func emphasize(w io.Writer, line string, words map[string]string, nice bool) { // advance line = line[m[1]:] } - fmt.Fprintf(w, line) + fmt.Fprint(w, line) } func indentLen(s string) int { diff --git a/testdata/pkg12_special_symbols/README.md b/testdata/pkg12_special_symbols/README.md index 83b9ec5..f35c8a2 100644 --- a/testdata/pkg12_special_symbols/README.md +++ b/testdata/pkg12_special_symbols/README.md @@ -2,5 +2,4 @@ Package pkg12 tests special symbols -This is issue #115: %! -(MISSING) +This is issue #115: %