diff options
author | Aki <please@ignore.pl> | 2024-09-02 23:24:34 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2024-09-02 23:24:34 +0200 |
commit | 2c6dc408d399197f44d5047072a6f2afcd140c17 (patch) | |
tree | 48705f654e1cc8c2d6262eb3b716b59b80073ba6 | |
parent | f6eed6c3d405395585f110ad91ce94011ee7ce1d (diff) | |
download | huh-2c6dc408d399197f44d5047072a6f2afcd140c17.zip huh-2c6dc408d399197f44d5047072a6f2afcd140c17.tar.gz huh-2c6dc408d399197f44d5047072a6f2afcd140c17.tar.bz2 |
Do not show day and month for consecutive posts on the same day
-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>" |