]> Sergey Matveev's repositories - sgblog.git/blobdiff - cmd/sgblog/http.go
Let's make HTML Atom for proper rendering, because of escape issues
[sgblog.git] / cmd / sgblog / http.go
index 808c3d99fd687b8c025114ea6ecb80c030bd2fc4..5b69fc50ecd9509e0d0cf5c222fc0d68cb97c600 100644 (file)
@@ -550,6 +550,12 @@ func serveHTTP() {
                        for _, topic := range parseTopics(getNote(topicsTree, commit.Hash)) {
                                categories = append(categories, atom.Category{Term: topic})
                        }
+                       htmlized := make([]string, 0, len(lines))
+                       htmlized = append(htmlized, "<pre>")
+                       for _, l := range lines[2:] {
+                               htmlized = append(htmlized, html.EscapeString(l))
+                       }
+                       htmlized = append(htmlized, "</pre>")
                        feed.Entry = append(feed.Entry, &atom.Entry{
                                Title: lines[0],
                                ID:    "urn:uuid:" + bytes2uuid(commit.Hash[:]),
@@ -561,8 +567,8 @@ func serveHTTP() {
                                Updated:   atom.Time(commit.Author.When),
                                Summary:   &atom.Text{Type: "text", Body: lines[0]},
                                Content: &atom.Text{
-                                       Type: "text",
-                                       Body: strings.Join(lines[2:], "\n"),
+                                       Type: "html",
+                                       Body: strings.Join(htmlized, "\n"),
                                },
                                Category: categories,
                        })