"os"
"strconv"
"strings"
+ "time"
"github.com/hjson/hjson-go"
"go.stargrave.org/sgblog"
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,
"os"
"strconv"
"strings"
+ "time"
"github.com/hjson/hjson-go"
"go.stargrave.org/sgblog"
`<th size="5%"><a title="Lines">L</a></th>` +
`<th size="5%"><a title="Comments">C</a></th>` +
"<th>Linked to</th></tr>\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(
+ "<tr><td colspan=6><center><tt>%04d-%02d-%02d</tt></center></td></tr>\n",
+ yearCur, monthCur, dayCur,
+ ))
+ yearPrev, monthPrev, dayPrev = yearCur, monthCur, dayCur
+ }
commitN++
lines := msgSplit(entry.commit.Message)
domains := []string{}
commentsValue = " "
}
table.WriteString(fmt.Sprintf(
- "<tr><td>%d</td><td><tt>%s</tt></td>"+
+ "<tr><td>%d</td><td><tt>%02d:%02d</tt></td>"+
"<td>%s</td>"+
"<td>%d</td><td>%s</td>"+
"<td>%s</td></tr>\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,