-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.lua
More file actions
72 lines (64 loc) · 1.45 KB
/
test.lua
File metadata and controls
72 lines (64 loc) · 1.45 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package.path = "?.lua"
local h = require"html"
local is_admin = true
local anonymous_user = false
local special_user
local mobile = false
local function item(title)
return h.DIV{
-- You can use either strings or tables in style key
style = {
display = "flex",
text_align = anonymous_user and "center",
justify_content = is_admin and "center" or "left",
color = special_user and "black",
background_color = is_admin and "green" or "gray"
},
-- or style = "display: flex; justify-content: center;"
class = {
is_admin and "button" or "card",
anonymous_user and "bg-gray",
special_user and "font-serif",
"justify-center",
md = {"text-lg", "w-full"},
lg = {
false and "text-2lg",
"shadow-md",
nil,
active = { -- not working yet
"text-red-600"
},
'hover:text-blue-500'
}
},
title
}
end
local t = {"first", "second", "third"}
local items = {}
for k,v in ipairs(t) do
table.insert(items, item(v))
end
print(
h.HTML{
h.BODY{
h.BR{},
h.BR{},
h.BR{},
-- h.H1{
-- style = {}
-- },
h.DIV{
mobile and "ok",
not mobile and "item1",
not not mobile and "item2",
"item3",
"item4",
not not mobile and "item5",
"item6",
"item7",
},
items
}
}
)