mirror of
https://github.com/golang/go
synced 2024-11-25 06:57:58 -07:00
godoc: don't double HTML-escape search result snippets
Fixes #1412. R=rsc, r CC=golang-dev https://golang.org/cl/3994041
This commit is contained in:
parent
cdb0bbf4d5
commit
f6f1401286
@ -93,7 +93,7 @@ func FormatSelections(w io.Writer, text []byte, lw LinkWriter, links Selection,
|
||||
segment := func(end int) {
|
||||
if lastOffs < end { // ignore empty segments
|
||||
if last.end != lastOffs || last.bitset != bitset {
|
||||
// the last segment is not adjacent or
|
||||
// the last segment is not adjacent to or
|
||||
// differs from the new one
|
||||
flush()
|
||||
// start a new segment
|
||||
|
@ -26,7 +26,7 @@ type Snippet struct {
|
||||
func newSnippet(fset *token.FileSet, decl ast.Decl, id *ast.Ident) *Snippet {
|
||||
// TODO instead of pretty-printing the node, should use the original source instead
|
||||
var buf bytes.Buffer
|
||||
writeNode(&buf, fset, decl, true)
|
||||
writeNode(&buf, fset, decl, false)
|
||||
return &Snippet{fset.Position(id.Pos()).Line, FormatText(buf.Bytes(), -1, true, id.Name, nil)}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user