From: Sergey Matveev Date: Sat, 14 Mar 2020 11:56:03 +0000 (+0300) Subject: Advertise SGBlog on Gopher pages X-Git-Tag: v0.4.0~2 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c92a7a154d1537286f9607f6aa4a6c896020b709;p=sgblog.git Advertise SGBlog on Gopher pages --- diff --git a/cmd/sgblog/gopher.go b/cmd/sgblog/gopher.go index a4a69fd..41dc9d1 100644 --- a/cmd/sgblog/gopher.go +++ b/cmd/sgblog/gopher.go @@ -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")) }