cmd/sgblog/gopher.go | 18 +++++++++++++++--- cmd/sgblog/http.go | 18 ++++++++++++++++-- common.go | 2 +- diff --git a/cmd/sgblog/gopher.go b/cmd/sgblog/gopher.go index a2e0be51a11b42ceec0d32d45f934f41eab6ab299c98b6c92c999eb6c5b70daf..47fc4eb632dc0e7b35a85debe2f9880f32d7771bdf2b607b84549e311a44e7ab 100644 --- a/cmd/sgblog/gopher.go +++ b/cmd/sgblog/gopher.go @@ -30,6 +30,7 @@ "log" "os" "strconv" "strings" + "time" "github.com/hjson/hjson-go" "go.stargrave.org/sgblog" @@ -95,22 +96,33 @@ } logEnded := false var menu bytes.Buffer + var yearPrev int + var monthPrev time.Month + var dayPrev int for i := 0; i < PageEntries; i++ { commit, err := repoLog.Next() if err != nil { logEnded = true break } + yearCur, monthCur, dayCur := commit.Author.When.Date() + if dayCur != dayPrev || monthCur != monthPrev || yearCur != yearPrev { + menu.WriteString(fmt.Sprintf( + "i%04d-%02d-%02d\t\tnull.host\t1%s", + yearCur, monthCur, dayCur, CRLF, + )) + yearPrev, monthPrev, dayPrev = yearCur, monthCur, dayCur + } commitN++ lines := msgSplit(commit.Message) - var commentsValue string if l := len(parseComments(getNote(commentsTree, commit.Hash))); l > 0 { commentsValue = fmt.Sprintf(" (%dC)", l) } menu.WriteString(fmt.Sprintf( - "0[%s] %s (%dL)%s\t/%s\t%s\t%d%s", - commit.Author.When.Format(sgblog.WhenFmt), + "0[%02d:%02d] %s (%dL)%s\t/%s\t%s\t%d%s", + commit.Author.When.Hour(), + commit.Author.When.Minute(), lines[0], len(lines)-2, commentsValue, diff --git a/cmd/sgblog/http.go b/cmd/sgblog/http.go index a8bc14525cdb902a08f97d303ab007a0ae6d79181698c136764c7892f5998087..4d6b47221a2396682d1eb24e73383994bd1e502d7d5f8b80fbee2f8c825e89b9 100644 --- a/cmd/sgblog/http.go +++ b/cmd/sgblog/http.go @@ -35,6 +35,7 @@ "net/url" "os" "strconv" "strings" + "time" "github.com/hjson/hjson-go" "go.stargrave.org/sgblog" @@ -300,7 +301,18 @@ "