-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.lua
45 lines (42 loc) · 1.12 KB
/
lib.lua
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
local lib = {}
function lib.page(content, errnum)
local T=tag
local names = {}
for k in pairs(modules) do
if not tonumber(k) then
table.append(names, k)
end
end
local text = doctype()(
T"head"(
T"title""Diamond", -- Add in scripts and CSS as needed
T"link"[{rel="stylesheet", href="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0-rc1/angular-material.min.css"}]()
),
T"body"[{layout="column"}](
T"md-toolbar"[{layout="row"}](
T"div"[{class="mdl-toolbar-tools"}](
T"h1""Diamond - Linux System Interface"
)
),
T"div"[{layout="row", class="flex"}](
T"md-sidenav"[{layout="column", class="md-sidenav-left md-whiteframe-4dp", ["md-component-id"]="left"}](
T"md-button"[{class="md-accent"}](names[1])
),
T"div"[{layout="column", id="content", class="flex"}](
T"md-content"[{layout="column", class="flex md-padding"}](
T"div"(content)
)
)
)
)
):render()
return text, errnum
end
function lib.genpage(title)
local page = params("page"):lower()
if not modules[page] then
page = 404
end
return content(page(modules[page].generate()))
end
return lib