local h = require"html"
local is_admin = true
local anonymous_user = false
local special_user
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"
},
-- or class = "button card"
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{
-- Tables are automatically expanded and concatenated
items
}
}
)```-
Notifications
You must be signed in to change notification settings - Fork 0
rousbound/html-lua
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published