initial commit
This commit is contained in:
38
lib/html/examples/html.luau
Normal file
38
lib/html/examples/html.luau
Normal file
@@ -0,0 +1,38 @@
|
||||
local net = require("@lute/net")
|
||||
|
||||
local htmluau = require("../src")
|
||||
|
||||
local html = htmluau.html
|
||||
local head = htmluau.head
|
||||
local title = htmluau.title
|
||||
local body = htmluau.body
|
||||
local h1 = htmluau.h1
|
||||
local button = htmluau.button
|
||||
local p = htmluau.p
|
||||
|
||||
local website = html({ lang = "en" }) {
|
||||
head() {
|
||||
title() {
|
||||
"Hello World",
|
||||
},
|
||||
},
|
||||
body() {
|
||||
h1() {
|
||||
"Hello World",
|
||||
},
|
||||
button({ onclick = "alert('Hello World!')" }) {
|
||||
"Click Me",
|
||||
},
|
||||
p() {
|
||||
"This is a simple HTML page generated using Luau.",
|
||||
"Lines are concatenated.",
|
||||
"So you can write sentences on separate lines.",
|
||||
"<html> is properly excaped.",
|
||||
},
|
||||
button(),
|
||||
},
|
||||
}
|
||||
|
||||
net.serve(function()
|
||||
return website()
|
||||
end)
|
Reference in New Issue
Block a user