diff options
-rwxr-xr-x | generate-index.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/generate-index.lua b/generate-index.lua index 0b94821..b079434 100755 --- a/generate-index.lua +++ b/generate-index.lua @@ -56,12 +56,20 @@ end table.sort(posts, function (lhs, rhs) return lhs.published > rhs.published end) print[[<table class="index">]] local year = nil +local previous = nil for _, page in pairs(posts) do local date = parse(page.published) if date and year ~= date.year then year = date.year + previous = nil print(string.format("<tr><td><b>%d</b><td><td>", year)) end - print(string.format([[<tr><td>%s<td class="sep">•<td><a href="%s">%s</a>]], describe(date), page.filename, page.title)) + date = describe(date) + if date == previous then + date = "" + else + previous = date + end + print(string.format([[<tr><td>%s<td class="sep">•<td><a href="%s">%s</a>]], date, page.filename, page.title)) end print"</table>" |