pretty up the generated HTML (2)

This commit is contained in:
mappu 2017-12-10 13:27:40 +13:00
parent f261ca0ece
commit add69c5c81
1 changed files with 4 additions and 4 deletions

View File

@ -253,18 +253,18 @@ func (this *ArchiveState) renderTemplateHead(w http.ResponseWriter) {
for ympair := this.log.EarliestDate(); !ympair.Equals(limit); ympair = ympair.Next() {
if ympair.Year != lastY {
if lastY != -1 {
w.Write([]byte("\t\t\t\t</optgroup>\n"))
w.Write([]byte("\t\t\t\t\t</optgroup>\n"))
}
w.Write([]byte(fmt.Sprintf("\t\t\t\t<optgroup label=\"%d\">\n", ympair.Year)))
w.Write([]byte(fmt.Sprintf("\t\t\t\t\t<optgroup label=\"%d\">\n", ympair.Year)))
lastY = ympair.Year
}
targetUri := fmt.Sprintf(`/%s/%d/%d`, this.logBestSlug, ympair.Year, ympair.Month)
w.Write([]byte(fmt.Sprintf("\t\t\t\t\t<option value=\"%s\"%s>%s</option>\n", html.EscapeString(targetUri), attr(ympair.Equals(this.ym), " selected"), html.EscapeString(ympair.Month.String()))))
w.Write([]byte(fmt.Sprintf("\t\t\t\t\t\t<option value=\"%s\"%s>%s</option>\n", html.EscapeString(targetUri), attr(ympair.Equals(this.ym), " selected"), html.EscapeString(ympair.Month.String()))))
}
if lastY != -1 {
w.Write([]byte("\t\t\t\t</optgroup>\n"))
w.Write([]byte("\t\t\t\t\t</optgroup>\n"))
}
w.Write([]byte(`
</select>