X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=cmd%2Fsgblog%2Fhttp.go;h=968555826bba8621a28e59578b0b859e6b626359;hb=f39628f13e14ba3ba94072c1cd4f747aa90228a1;hp=18477a6c53fa6b7c81159a040daae8e067247125;hpb=0481d87d1a0f92ca1f4465d755a89864606bb6df;p=sgblog.git diff --git a/cmd/sgblog/http.go b/cmd/sgblog/http.go index 18477a6..9685558 100644 --- a/cmd/sgblog/http.go +++ b/cmd/sgblog/http.go @@ -35,6 +35,7 @@ import ( "os" "strconv" "strings" + "time" "github.com/hjson/hjson-go" "go.stargrave.org/sgblog" @@ -300,7 +301,18 @@ func serveHTTP() { `L` + `C` + "Linked to\n") + var yearPrev int + var monthPrev time.Month + var dayPrev int for _, entry := range entries { + yearCur, monthCur, dayCur := entry.commit.Author.When.Date() + if dayCur != dayPrev || monthCur != monthPrev || yearCur != yearPrev { + table.WriteString(fmt.Sprintf( + "
%04d-%02d-%02d
\n", + yearCur, monthCur, dayCur, + )) + yearPrev, monthPrev, dayPrev = yearCur, monthCur, dayCur + } commitN++ lines := msgSplit(entry.commit.Message) domains := []string{} @@ -318,11 +330,13 @@ func serveHTTP() { commentsValue = " " } table.WriteString(fmt.Sprintf( - "%d%s"+ + "%d%02d:%02d"+ "%s"+ "%d%s"+ "%s\n", - commitN, entry.commit.Author.When.Format(sgblog.WhenFmt), + commitN, + entry.commit.Author.When.Hour(), + entry.commit.Author.When.Minute(), makeA(cfg.URLPrefix+"/"+entry.commit.Hash.String(), lines[0]), len(lines)-2, commentsValue,