1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
require'h'
local head = mkhead'blog listing'
local top = mktopbox('/me.png','rebecca blog',p'page listing')
local bread = bcrumb{
{'< home','/'},
{'rebecca blog'}
}
local metas={}
local posix = require'posix'
for fname in posix.dirent.files'blog' do
if fname:sub(1,1) ~= '.' then
local meta = loadfile('blog/'..fname)(true)
meta.fname = meta.fname or fname:gsub('%.lua$','')
table.insert(metas,meta)
end
end
table.sort(metas,function(a,b) return a.date>b.date end)
local list = {}
for _,it in ipairs(metas) do
table.insert(list, li{
tag('time',{datetime=it.date},it.date),
a(it.title,'/blog/'..it.fname..'.html')
})
end
local listsect = section {
p'the',
ul({class="postlist"},list)
}
print(html{
head, top, bread, listsect
})
|