From c92a7a154d1537286f9607f6aa4a6c896020b709 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sat, 14 Mar 2020 14:56:03 +0300 Subject: [PATCH] Advertise SGBlog on Gopher pages --- cmd/sgblog/gopher.go | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) 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")) } -- 2.48.1