lines := strings.Split(comments[len(comments)-1], "\n")
from := strings.TrimPrefix(lines[0], "From: ")
date := strings.TrimPrefix(lines[1], "Date: ")
+ htmlized := make([]string, 0, len(lines))
+ htmlized = append(htmlized, "<pre>")
+ for _, l := range lines[2:] {
+ htmlized = append(htmlized, lineURLize(cfg.AtomBaseURL+cfg.URLPrefix, l))
+ }
+ htmlized = append(htmlized, "</pre>")
idHasher.Reset()
idHasher.Write([]byte("COMMENT"))
idHasher.Write(commit.Hash[:])
Published: atom.TimeStr(date),
Updated: atom.TimeStr(date),
Content: &atom.Text{
- Type: "text",
- Body: strings.Join(lines[2:], "\n"),
+ Type: "html",
+ Body: strings.Join(htmlized, "\n"),
},
})
}
idHasher.Write([]byte("COMMENT"))
idHasher.Write(commit.Hash[:])
idHasher.Write([]byte(comment.n))
+ htmlized := make([]string, 0, len(comment.body))
+ htmlized = append(htmlized, "<pre>")
+ for _, l := range comment.body {
+ htmlized = append(
+ htmlized,
+ lineURLize(cfg.AtomBaseURL+cfg.URLPrefix, l),
+ )
+ }
+ htmlized = append(htmlized, "</pre>")
feed.Entry = append(feed.Entry, &atom.Entry{
Title: fmt.Sprintf("Comment %s by %s", comment.n, comment.from),
Author: &atom.Person{Name: comment.from},
Published: atom.TimeStr(comment.date),
Updated: atom.TimeStr(comment.date),
Content: &atom.Text{
- Type: "text",
- Body: strings.Join(comment.body, "\n"),
+ Type: "html",
+ Body: strings.Join(htmlized, "\n"),
},
})
}