From 342371d4b6800f78b1ed7d0a929194931100f77f Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 15 Mar 2020 15:02:02 +0300 Subject: [PATCH] Leave comments link on gopher page --- cmd/sgblog/gopher.go | 12 ++++++++++-- cmd/sgblog/http.go | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cmd/sgblog/gopher.go b/cmd/sgblog/gopher.go index bcac38c..f27b765 100644 --- a/cmd/sgblog/gopher.go +++ b/cmd/sgblog/gopher.go @@ -42,7 +42,7 @@ const CRLF = "\r\n" var DashLine = strings.Repeat("-", 72) func makeI(cfg *Cfg, value string) string { - return strings.Join([]string{"i"+value, "err", cfg.GopherDomain, "70", CRLF}, "\t") + return strings.Join([]string{"i" + value, "err", cfg.GopherDomain, "70", CRLF}, "\t") } func serveGopher() { @@ -160,7 +160,7 @@ func serveGopher() { ) } fmt.Print(menu.String()) - fmt.Printf(makeI(cfg, "Generated by: SGBlog " + sgblog.Version)) + fmt.Printf(makeI(cfg, "Generated by: SGBlog "+sgblog.Version)) fmt.Print("." + CRLF) } else if strings.HasPrefix(selector, "URL:") { selector = selector[len("URL:"):] @@ -190,6 +190,14 @@ Redirecting to %s... if len(notesRaw) > 0 { fmt.Printf("%s\nNote:\n%s\n", DashLine, string(notesRaw)) } + if cfg.CommentsEmail != "" { + fmt.Printf( + "%s\nleave comment: mailto:%s?subject=%s\n", + DashLine, + cfg.CommentsEmail, + commit.Hash.String(), + ) + } for i, comment := range parseComments(getNote(commentsTree, commit.Hash)) { fmt.Printf("%s\ncomment %d:\n%s\n", DashLine, i, comment) } diff --git a/cmd/sgblog/http.go b/cmd/sgblog/http.go index 7275c71..4d88fb8 100644 --- a/cmd/sgblog/http.go +++ b/cmd/sgblog/http.go @@ -482,7 +482,7 @@ func serveHTTP() { } out.Write([]byte(fmt.Sprintf( "[%s]\n"+ - "[%s]\n"+ + "[%s]\n"+ "
\n

%s

\n
\n",
 			when, commit.Hash.String(), title,
 		)))
@@ -496,7 +496,7 @@ func serveHTTP() {
 		if cfg.CommentsEmail != "" {
 			out.Write([]byte("[" + makeA(
 				"mailto:"+cfg.CommentsEmail+"?subject="+commit.Hash.String(),
-				"write comment",
+				"leave comment",
 			) + "]\n"))
 		}
 		out.Write([]byte("
\n")) -- 2.48.1