cmd/sgblog/http.go | 23 +++++++++++++++++++---- common.go | 2 +- diff --git a/cmd/sgblog/http.go b/cmd/sgblog/http.go index 19e0834a0897585fe19e2421c819326478d4ad376949a603c79c29b005beba91..8d10b983a0eb237a17867cfa3ebfee5a7b11cd098dd7019fe19303d50b96bb60 100644 --- a/cmd/sgblog/http.go +++ b/cmd/sgblog/http.go @@ -635,6 +635,12 @@ commentN := strconv.Itoa(len(comments) - 1) 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, "
")
+			for _, l := range lines[2:] {
+				htmlized = append(htmlized, lineURLize(cfg.AtomBaseURL+cfg.URLPrefix, l))
+			}
+			htmlized = append(htmlized, "
") idHasher.Reset() idHasher.Write([]byte("COMMENT")) idHasher.Write(commit.Hash[:]) @@ -656,8 +662,8 @@ }}, 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"), }, }) } @@ -733,6 +739,15 @@ idHasher.Reset() idHasher.Write([]byte("COMMENT")) idHasher.Write(commit.Hash[:]) idHasher.Write([]byte(comment.n)) + htmlized := make([]string, 0, len(comment.body)) + htmlized = append(htmlized, "
")
+				for _, l := range comment.body {
+					htmlized = append(
+						htmlized,
+						lineURLize(cfg.AtomBaseURL+cfg.URLPrefix, l),
+					)
+				}
+				htmlized = append(htmlized, "
") feed.Entry = append(feed.Entry, &atom.Entry{ Title: fmt.Sprintf("Comment %s by %s", comment.n, comment.from), Author: &atom.Person{Name: comment.from}, @@ -749,8 +764,8 @@ }}, 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"), }, }) } diff --git a/common.go b/common.go index d6004ac9ace68993f1794f6ffa3cfef6810c62e6799f37cbc6c2fa706b7a8831..e7b99d2e7c1a024ba028c6debfd8fca227eb3b5591f3b443310c7483042df320 100644 --- a/common.go +++ b/common.go @@ -2,6 +2,6 @@ // SGBlog -- Git-backed CGI/inetd blogging/phlogging engine package sgblog const ( - Version = "0.12.0" + Version = "0.13.0" WhenFmt = "2006-01-02 15:04:05Z07:00" )