]> Sergey Matveev's repositories - sgblog.git/commitdiff
Advertise SGBlog on Gopher pages
authorSergey Matveev <stargrave@stargrave.org>
Sat, 14 Mar 2020 11:56:03 +0000 (14:56 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 14 Mar 2020 11:59:35 +0000 (14:59 +0300)
cmd/sgblog/gopher.go

index a4a69fd261105b44f621e9d7384f0f7c61d6dd06..41dc9d16089c15737d8f18bc76d4ce81271d8c6b 100644 (file)
@@ -130,38 +130,36 @@ func serveGopher() {
                        ))
                }
 
-               var links bytes.Buffer
+               fmt.Printf(
+                       "i%s (%d-%d)\t\tnull.host\t1%s",
+                       cfg.Title,
+                       offset,
+                       offset+PageEntries,
+                       CRLF,
+               )
+               if cfg.AboutURL != "" {
+                       fmt.Printf("iAbout: %s\t\tnull.host\t1%s", cfg.AboutURL, CRLF)
+               }
                if offset > 0 {
                        offsetPrev := offset - PageEntries
                        if offsetPrev < 0 {
                                offsetPrev = 0
                        }
-                       links.WriteString(fmt.Sprintf(
+                       fmt.Printf(
                                "1Prev\toffset/%d\t%s\t%d%s",
                                offsetPrev,
                                cfg.GopherDomain, 70, CRLF,
-                       ))
+                       )
                }
                if !logEnded {
-                       links.WriteString(fmt.Sprintf(
+                       fmt.Printf(
                                "1Next\toffset/%d\t%s\t%d%s",
                                offset+PageEntries,
                                cfg.GopherDomain, 70, CRLF,
-                       ))
-               }
-
-               fmt.Printf(
-                       "i%s (%d-%d)\t\tnull.host\t1%s",
-                       cfg.Title,
-                       offset,
-                       offset+PageEntries,
-                       CRLF,
-               )
-               if cfg.AboutURL != "" {
-                       fmt.Printf("iAbout: %s\t\tnull.host\t1%s", cfg.AboutURL, CRLF)
+                       )
                }
-               fmt.Print(links.String())
                fmt.Print(menu.String())
+               fmt.Printf("iGenerated by: SGBlog %s\t\tnull.host\t1%s", sgblog.Version, CRLF)
                fmt.Print("." + CRLF)
        } else if sha1DigestRe.MatchString(selector) {
                commit, err := repo.CommitObject(plumbing.NewHash(selector[1:]))
@@ -182,6 +180,7 @@ func serveGopher() {
                for i, comment := range parseComments(getNote(commentsTree, commit.Hash)) {
                        fmt.Printf("%s\ncomment %d:\n%s\n", DashLine, i, comment)
                }
+               fmt.Printf("%s\nGenerated by: SGBlog %s\n", DashLine, sgblog.Version)
        } else {
                log.Fatalln(errors.New("unknown selector"))
        }