From 2c6dc408d399197f44d5047072a6f2afcd140c17 Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 2 Sep 2024 23:24:34 +0200 Subject: Do not show day and month for consecutive posts on the same day --- generate-index.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'generate-index.lua') 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[[]] 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("
%d", year)) end - print(string.format([[
%s%s]], describe(date), page.filename, page.title)) + date = describe(date) + if date == previous then + date = "" + else + previous = date + end + print(string.format([[
%s%s]], date, page.filename, page.title)) end print"
" -- cgit v1.1