]> Sergey Matveev's repositories - sgblog.git/commitdiff
Leave comments link on gopher page v0.5.0
authorSergey Matveev <stargrave@stargrave.org>
Sun, 15 Mar 2020 12:02:02 +0000 (15:02 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 15 Mar 2020 12:07:40 +0000 (15:07 +0300)
cmd/sgblog/gopher.go
cmd/sgblog/http.go

index bcac38ce99f3f435e8b73c42690147203514a96e..f27b765b7d9cbfc4ac388a4eb2c16b88feb3730f 100644 (file)
@@ -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 <a href="%s">%s</a>...
                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)
                }
index 7275c718919c98733f193128998ee3933df14cb8..4d88fb8cdbb10f18221805310af5578972d59148 100644 (file)
@@ -482,7 +482,7 @@ func serveHTTP() {
                }
                out.Write([]byte(fmt.Sprintf(
                        "[<tt><a title=\"When\">%s</a></tt>]\n"+
-                               "[<tt><a title=\"Hash\">%s</a></tt>]\n"+
+                               "[<tt><a title=\"What\">%s</a></tt>]\n"+
                                "<hr/>\n<h2>%s</h2>\n<pre>\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("<dl>\n"))