blob: b53beb211b14534e0ed528134dfe4e0ccf5f3cf9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/usr/bin/env lua
local datetime = require"huh.datetime"
local config = require"huh.config".load(arg[1])
local posts = require"huh.blog".posts(config)
print[[<table class="index">]]
local year = nil
local previous = nil
for _, page in pairs(posts) do
local date = datetime.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
date = datetime.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>"
|