This commit is contained in:
2025-11-19 20:29:00 -05:00
parent 7d70a4a884
commit 5cfaddf479
9 changed files with 583 additions and 0 deletions

172
core/builtin.lua Normal file
View File

@@ -0,0 +1,172 @@
local M = {}
M.__index = M
function M.site_builder(header, footer)
local config = {}
local site_config = {}
local fes_mod = package.loaded.fes
if fes_mod and fes_mod.config then
config = fes_mod.config
if config.site then
site_config = config.site
end
end
local self = {
version = site_config.version or "",
header = header or [[
<!DOCTYPE html>
<html lang="en">
<style>
html,
body {
height: 100%
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background: #0f1113;
color: #e6eef3;
line-height: 1.45;
padding: 36px;
}
.container {
max-width: 1100px;
margin: 0 auto
}
h1 {
font-size: 40px;
margin: 0 0 18px 0;
font-weight: 700;
}
.note {
background: #17191b;
border: 1px solid rgba(255, 255, 255, 0.06);
padding: 18px;
border-radius: 4px;
margin: 12px 0 26px 0;
color: #dfe9ee;
}
.note strong {
color: #f0f6f8
}
.callout {
display: block;
margin: 10px 0
}
a {
color: #68a6ff;
text-decoration: none
}
a:hover {
text-decoration: underline
}
p {
margin: 12px 0
}
.muted {
color: #9aa6b1
}
.lead {
font-size: 15px;
margin-top: 8px
}
.highlight {
font-weight: 700;
color: #cde7ff
}
.small {
font-size: 13px;
color: #9aa6b1;
margin-top: 6px
}
.links {
margin: 10px 0
}
.section {
margin-top: 18px
}
</style>
<body>
<div class="container">
]],
footer = footer or [[
</div>
</body>
</html>
]],
parts = {}
}
return setmetatable(self, M)
end
function M:custom(str)
table.insert(self.parts, str)
return self
end
function M:h1(str)
str = str or ""
table.insert(self.parts, "<h1>" .. str .. "</h1>")
return self
end
function M:h2(str)
str = str or ""
table.insert(self.parts, "<h2>" .. str .. "</h2>")
return self
end
function M:h3(str)
str = str or ""
table.insert(self.parts, "<h3>" .. str .. "</h3>")
return self
end
function M:h4(str)
str = str or ""
table.insert(self.parts, "<h4>" .. str .. "</h4>")
return self
end
function M:h5(str)
str = str or ""
table.insert(self.parts, "<h5>" .. str .. "</h5>")
return self
end
function M:h6(str)
str = str or ""
table.insert(self.parts, "<h6>" .. str .. "</h6>")
return self
end
function M:version()
return self.version
end
function M:build()
return self.header .. table.concat(self.parts) .. self.footer
end
M.__tostring = function(self)
return self:build()
end
return M

19
core/std.lua Normal file
View File

@@ -0,0 +1,19 @@
local M = {}
function M.fes_version()
local fes_mod = package.loaded.fes
if fes_mod and fes_mod.config and fes_mod.config.fes and fes_mod.config.fes.version then
return fes_mod.config.fes.version
end
return ""
end
function M.site_version()
local fes_mod = package.loaded.fes
if fes_mod and fes_mod.config and fes_mod.config.site and fes_mod.config.site.version then
return fes_mod.config.site.version
end
return ""
end
return M