@@ -2,10 +2,11 @@ package changes import ( "bytes" "fmt" "html/template" "log" "sort" "strings" "time" "dmitri.shuralyov.com/app/changes/component" @@ -196,15 +197,18 @@ func (f fileDiff) Title() (template.HTML, error) { func (f fileDiff) Diff() (template.HTML, error) { hunks, err := diff.PrintHunks(f.Hunks) if err != nil { return "", err } diff, err := highlightDiff(hunks) html, err := highlightDiff(hunks) if err != nil { return "", err log.Println("fileDiff.Diff: highlightDiff:", err) var buf bytes.Buffer template.HTMLEscape(&buf, hunks) html = buf.Bytes() } return template.HTML(diff), nil return template.HTML(html), nil } // highlightDiff highlights the src diff, returning the annotated HTML. func highlightDiff(src []byte) ([]byte, error) { anns, err := highlight_diff.Annotate(src)