]> Sergey Matveev's repositories - sgblog.git/commitdiff
Let's make HTML Atom for proper rendering, because of escape issues v0.11.0
authorSergey Matveev <stargrave@stargrave.org>
Mon, 23 Nov 2020 13:22:49 +0000 (16:22 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 23 Nov 2020 13:22:49 +0000 (16:22 +0300)
cmd/sgblog/http.go
common.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,
                        })
index b324d87d85f8acbf99abb70e7f3cc2b8fe345221..73ed5e5a158dfe7af4d9e5f8fa98a2af3eb602f5 100644 (file)
--- a/common.go
+++ b/common.go
@@ -2,6 +2,6 @@
 package sgblog
 
 const (
-       Version = "0.10.1"
+       Version = "0.11.0"
        WhenFmt = "2006-01-02 15:04:05Z07:00"
 )