diff options
Diffstat (limited to 'src/pkg/go/doc/comment.go')
| -rw-r--r-- | src/pkg/go/doc/comment.go | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/pkg/go/doc/comment.go b/src/pkg/go/doc/comment.go index 75eb7064b..3d04c349c 100644 --- a/src/pkg/go/doc/comment.go +++ b/src/pkg/go/doc/comment.go @@ -133,7 +133,7 @@ func commentEscape(w io.Writer, s []byte) { last := 0; for i := 0; i < len(s)-1; i++ { if s[i] == s[i+1] && (s[i] == '`' || s[i] == '\'') { - template.HtmlEscape(w, s[last:i]); + template.HTMLEscape(w, s[last:i]); last = i+2; switch s[i] { case '`': @@ -144,7 +144,7 @@ func commentEscape(w io.Writer, s []byte) { i++; // loop will add one more } } - template.HtmlEscape(w, s[last:len(s)]); + template.HTMLEscape(w, s[last:len(s)]); } @@ -211,10 +211,9 @@ func unindent(block [][]byte) { // // TODO(rsc): I'd like to pass in an array of variable names []string // and then italicize those strings when they appear as words. -func ToHtml(w io.Writer, s []byte) { +func ToHTML(w io.Writer, s []byte) { inpara := false; - /* TODO(rsc): 6g cant generate code for these close := func() { if inpara { w.Write(html_endp); @@ -227,7 +226,6 @@ func ToHtml(w io.Writer, s []byte) { inpara = true; } }; - */ lines := split(s); unindent(lines); @@ -235,19 +233,13 @@ func ToHtml(w io.Writer, s []byte) { line := lines[i]; if isBlank(line) { // close paragraph - if inpara { - w.Write(html_endp); - inpara = false; - } + close(); i++; continue; } if indentLen(line) > 0 { // close paragraph - if inpara { - w.Write(html_endp); - inpara = false; - } + close(); // count indented or blank lines j := i+1; @@ -268,21 +260,15 @@ func ToHtml(w io.Writer, s []byte) { // just html escaping w.Write(html_pre); for _, line := range block { - template.HtmlEscape(w, line); + template.HTMLEscape(w, line); } w.Write(html_endpre); continue; } // open paragraph - if !inpara { - w.Write(html_p); - inpara = true; - } + open(); commentEscape(w, lines[i]); i++; } - if inpara { - w.Write(html_endp); - inpara = false; - } + close(); } |
