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
38
39
40
41
42
43
44
45
46
|
local navigation_table = {
{'home', '/index.html'},
{'projects', '/projects/'},
{'git', '/git'},
{'about', '/about.html'},
}
local navlinks = ''
for _, link in pairs(navigation_table) do
navlinks = navlinks ..
string.format('<a href="%s">%s</a> ', link[2], link[1])
end
navlinks = string.sub(navlinks, 1, -4)
local navigation = string.format('<div id="navigation"><pre>%s</pre></div>', navlinks)
return function(html, page_tbl)
local html = string.gsub(
html,
'<h1>(.-)</h1>',
'<p class="centered">%1<br>================================</p>'
)
local fmt = [[
<!doctype html>
<html>
<meta charset="utf-8">
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<title>%s</title>
<link rel="stylesheet" href="/style.css">
</html>
<body>
%s
<div id="content">
%s
</div>
</body>
</html>
]]
return string.format(
fmt,
string.format('%s | %s', page_tbl.title, argent.config.site_name),
navigation,
html)
end
|