From b6c07c34529a6def9c31ef5c2591022898649500 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Mon, 23 Nov 2020 16:22:49 +0300 Subject: [PATCH] Let's make HTML Atom for proper rendering, because of escape issues --- cmd/sgblog/http.go | 10 ++++++++-- common.go | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/sgblog/http.go b/cmd/sgblog/http.go index 808c3d9..5b69fc5 100644 --- a/cmd/sgblog/http.go +++ b/cmd/sgblog/http.go @@ -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, "
")
+			for _, l := range lines[2:] {
+				htmlized = append(htmlized, html.EscapeString(l))
+			}
+			htmlized = append(htmlized, "
") 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, }) diff --git a/common.go b/common.go index b324d87..73ed5e5 100644 --- 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" ) -- 2.44.0