This commit is contained in:
2025-11-28 15:56:49 -05:00
parent e2d31aa734
commit 705911ac9d
21 changed files with 791 additions and 480 deletions

View File

@@ -27,23 +27,85 @@ function M.fes(header, footer)
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>{{TITLE}}</title>
<style>
html,body{
min-height:100%;
background:#0f1113;
html, body {
min-height: 100%;
margin: 0;
padding: 0;
background: #0f1113;
color: #e6eef3;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body{
margin:0;
padding:36px;
font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
background:#0f1113;
color:#e6eef3;
line-height:1.45
}
.container{max-width:1100px;margin:0 auto}
h1,h2,h3,h4,h5,h6{
font-weight:600;
margin:0 0 12px 0
body {
padding: 36px;
}
.container {
max-width: 830px;
margin: 0 auto;
}
.container > *:not(.banner) {
margin: 28px 0;
}
h1, h2, h3, h4, h5, h6 {
font-weight: 600;
margin: 0 0 12px 0;
}
h1 {
font-size: 40px;
margin-bottom: 20px;
font-weight: 700;
}
h2 {
font-size: 32px;
margin: 26px 0 14px;
}
h3 {
font-size: 26px;
margin: 22px 0 12px;
}
h4 {
font-size: 20px;
margin: 18px 0 10px;
}
h5 {
font-size: 16px;
margin: 16px 0 8px;
}
h6 {
font-size: 14px;
margin: 14px 0 6px;
color: #9aa6b1;
}
p {
margin: 14px 0;
}
a {
color: #68a6ff;
text-decoration: none;
transition: color .15s ease, text-decoration-color .15s ease;
}
.hidden {
color: #dfe9ee;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
summary {
@@ -51,172 +113,265 @@ summary {
}
details {
background:#17191b;
border:1px solid rgba(255,255,255,.06);
border-radius:4px;
padding:12px 14px;
margin:14px 0;
background: #1a1c20;
border: 1px solid rgba(255,255,255,.06);
border-radius: 4px;
padding: 14px 16px;
margin: 16px 0;
}
details summary {
list-style: none;
cursor: pointer;
font-weight:600;
color:#e6eef3;
font-weight: 600;
color: #e6eef3;
display: flex;
align-items: center;
}
details summary::-webkit-details-marker {
display:none;
display: none;
}
details summary::before {
content:"▸";
display:inline-block;
margin-right:8px;
transition:transform .15s ease;
color:#68a6ff;
content: "▸";
margin-right: 8px;
transition: transform .15s ease;
color: #68a6ff;
}
details[open] summary::before {
transform: rotate(90deg);
}
summary::after {
content: "Expand description";
content: "Expand";
margin-left: auto;
font-size: 13px;
color: #9aa6b1;
}
details[open] summary::after {
content: "Close description";
content: "Collapse";
}
details > *:not(summary) {
margin-top:10px;
margin-top: 12px;
}
h1{font-size:40px;margin-bottom:18px;font-weight:700}
h2{font-size:32px;margin:24px 0 14px}
h3{font-size:26px;margin:20px 0 12px}
h4{font-size:20px;margin:16px 0 10px}
h5{font-size:16px;margin:14px 0 8px}
h6{font-size:14px;margin:12px 0 6px;color:#9aa6b1}
p{margin:12px 0}
a{
color:#68a6ff;
text-decoration:none
}
a:hover{text-decoration:underline}
.note,pre,code{
background:#17191b;
border:1px solid rgba(255,255,255,.06)
}
.note{
padding:18px;
border-radius:4px;
margin:12px 0 26px;
color:#dfe9ee
}
.note strong{color:#f0f6f8}
.muted{color:#9aa6b1}
.lead{font-size:15px;margin-top:8px}
.callout{display:block;margin:10px 0}
.small{font-size:13px;color:#9aa6b1;margin-top:6px}
.highlight{font-weight:700;color:#cde7ff}
ul,ol{margin:12px 0;padding-left:24px}
li{margin:6px 0}
code{
padding:2px 6px;
border-radius:3px;
font-family:"SF Mono",Monaco,"Cascadia Code","Roboto Mono",Consolas,"Courier New",monospace;
font-size:.9em;
color:#cde7ff
}
pre{
padding:18px;
border-radius:4px;
margin:12px 0;
overflow-x:auto;
font-family:"SF Mono",Monaco,"Cascadia Code","Roboto Mono",Consolas,"Courier New",monospace;
font-size:14px;
line-height:1.5
}
pre code{
background:none;
border:none;
padding:0;
font-size:inherit
.note, pre, code {
background: #1a1c20;
border: 1px solid rgba(255,255,255,.06);
}
blockquote{
border-left:3px solid #68a6ff;
padding-left:18px;
margin:12px 0;
color:#dfe9ee;
font-style:italic
.note {
padding: 20px;
border-radius: 4px;
background: #1a1c20;
border: 1px solid rgba(255,255,255,.06);
margin: 28px 0;
color: #dfe9ee;
}
hr{
border:none;
border-top:1px solid rgba(255,255,255,.1);
margin:24px 0
.note strong {
color: #f0f6f8;
}
img{
max-width:100%;
height:auto;
border-radius:4px;
margin:12px 0
.muted {
color: #9aa6b1;
}
table{
width:100%;
border-collapse:collapse;
margin:12px 0
}
th,td{
padding:10px 14px;
text-align:left;
border-bottom:1px solid rgba(255,255,255,.06)
}
th{
background:#17191b;
font-weight:600;
color:#f0f6f8
}
tr:hover{background:rgba(255,255,255,.02)}
.divider{
margin:24px 0;
height:1px;
background:rgba(255,255,255,.1)
.lead {
font-size: 15px;
margin-top: 8px;
}
.section{margin-top:32px}
.links{margin:10px 0}
.links a{
display:inline-block;
margin:0 12px 6px 0
.callout {
display: block;
margin: 12px 0;
}
strong,b{font-weight:600;color:#f0f6f8}
em,i{font-style:italic}
.small {
font-size: 13px;
color: #9aa6b1;
margin-top: 6px;
}
.highlight {
font-weight: 700;
color: #cde7ff;
}
ul, ol {
margin: 14px 0;
padding-left: 26px;
}
.tl {
display: grid;
grid-template-columns: repeat(auto-fill, 200px);
gap: 15px;
list-style-type: none;
padding: 0;
margin: 0;
justify-content: start;
}
ul.tl li {
padding: 10px;
width: fit-content;
}
li {
margin: 6px 0;
}
code {
padding: 3px 7px;
border-radius: 3px;
font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
font-size: .9em;
color: #cde7ff;
}
pre {
padding: 20px;
border-radius: 4px;
margin: 14px 0;
overflow-x: auto;
font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
font-size: 14px;
line-height: 1.6;
}
pre code {
background: none;
border: none;
padding: 0;
font-size: inherit;
}
blockquote {
border-left: 3px solid #68a6ff;
padding-left: 18px;
margin: 14px 0;
color: #dfe9ee;
font-style: italic;
}
hr {
border: 0;
border-top: 1px solid rgba(255,255,255,.1);
margin: 26px 0;
}
img {
max-width: 100%;
height: auto;
border-radius: 4px;
margin: 14px 0;
}
table {
width: 100%;
border-collapse: collapse;
margin: 14px 0;
}
th, td {
padding: 12px 16px;
text-align: left;
border-bottom: 1px solid rgba(255,255,255,.06);
}
th {
background: #1a1c20;
font-weight: 600;
color: #f0f6f8;
}
tr:hover {
background: rgba(255,255,255,.02);
}
.divider {
margin: 26px 0;
height: 1px;
background: rgba(255,255,255,.1);
}
.section {
margin-top: 36px;
}
.links {
margin: 12px 0;
}
.links a {
display: inline-block;
margin: 0 14px 6px 0;
}
strong, b {
font-weight: 600;
color: #f0f6f8;
}
em, i {
font-style: italic;
}
.note {
padding: 20px;
border-radius: 4px;
background: #1a1c20;
border: 1px solid rgba(255,255,255,.06);
margin: 28px 0;
color: #dfe9ee;
}
.center {
display: flex;
justify-content: center;
align-items: center;
}
.banner {
width: 100%;
box-sizing: border-box;
text-align: center;
background: #1a1c20;
padding: 20px;
border: 1px solid rgba(255,255,255,.06);
border-bottom-right-radius: 8px;
border-bottom-left-radius: 8px;
color: #e6eef3;
margin: -36px 0 28px 0;
box-shadow: 0 0.2em 0.6em rgba(0,0,0,.4);
}
.nav {
margin-left: auto;
margin-right: auto;
}
.nav a {
color: #cde7ff;
}
.footer {
background: #1a1c20;
margin-top: 36px;
padding: 18px 0;
border-top: 1px solid rgba(255,255,255,.1);
font-size: 14px;
color: #d4dde3;
display: flex;
justify-content: center;
align-items: center;
gap: 24px;
background: #1a1c20;
padding: 20px 0;
border-top: 1px solid rgba(255,255,255,.1);
font-size: 14px;
color: #d4dde3;
display: flex;
justify-content: center;
align-items: center;
gap: 24px;
margin-top: 28px !important; /* <— Makes it reappear */
margin-bottom: 0;
}
</style>
</head>
<body>
@@ -304,6 +459,13 @@ function M:a(link, str)
return self
end
function M:ha(link, str)
link = link or "example.com"
str = str or link
table.insert(self.parts, "<a class=\"hidden\" href=\"" .. link .. "\">" .. str .. "</a>")
return self
end
function M:external(link, str)
link = link or "example.com"
str = str or link
@@ -454,26 +616,30 @@ end
function M:lead(str)
str = str or ""
self:custom('<p class="lead">' .. str .. '</p>')
self:custom(std.small(str))
return self
end
function M:small(str)
str = str or ""
self:custom('<div class="small">' .. str .. '</div>')
self:custom(std.small(str))
return self
end
function M:highlight(str)
str = str or ""
self:custom('<span class="highlight">' .. str .. '</span>')
self:custom(std.highlight(str))
return self
end
function M:banner(str)
self:custom(std.banner(str))
end
function M:build()
local header = self.header:gsub("{{TITLE}}", self.title or "Document")
local footer = self.footer:gsub("{{COPYRIGHT}}", self.copyright or "&#169; The Copyright Holder")
return header .. table.concat(self.parts) .. footer
return header .. table.concat(self.parts, "\n") .. footer
end
M.__tostring = function(self)

View File

@@ -1,19 +0,0 @@
local M = {}
function M.log(fmt, ...)
print(string.format("[%12f] ", os.clock()) .. string.format(fmt, ...))
end
function M.info(fmt, ...)
print("INFO: " .. string.format(fmt, ...))
end
function M.warn(fmt, ...)
print("WARN: " .. string.format(fmt, ...))
end
function M.error(fmt, ...)
print("ERROR: " .. string.format(fmt, ...))
end
return M

7
core/log.lua Normal file
View File

@@ -0,0 +1,7 @@
local M = {}
function M.printl(fmt, ...)
print(string.format(fmt, ...))
end
return M

View File

@@ -1,19 +0,0 @@
local M = {}
-- Markdown to HTML conversion function
-- Uses the Go backend markdown parser
function M.to_html(markdown_text)
markdown_text = markdown_text or ""
-- Get the fes module
local fes_mod = package.loaded.fes
if fes_mod and fes_mod.markdown_to_html then
return fes_mod.markdown_to_html(markdown_text)
end
-- Fallback: return error message if Go function not available
return "<p>Error: markdown_to_html function not available</p>"
end
return M

View File

@@ -17,9 +17,17 @@ function M.site_version()
end
function M.a(link, str)
link = link or "https://example.com"
str = str or link
return "<a href=\"" .. link .. "\">" .. str .. "</a>"
end
function M.ha(link, str)
link = link or "https://example.com"
str = str or link
return "<a class=\"hidden\" href=\"" .. link .. "\">" .. str .. "</a>"
end
function M.external(link, str)
return "<a target=\"_blank\" href=\"" .. link .. "\">" .. str .. "</a>"
end
@@ -92,6 +100,16 @@ function M.ol(items)
return html
end
function M.tl(items)
items = items or {}
local html = '<ul class="tl">'
for _, item in ipairs(items) do
html = html .. "<li>" .. tostring(item) .. "</li>"
end
html = html .. "</ul>"
return html
end
function M.blockquote(str)
return "<blockquote>" .. (str or "") .. "</blockquote>"
end
@@ -191,13 +209,13 @@ end
function M.table(headers, rows)
headers = headers or {}
rows = rows or {}
local html = "<table><thead><tr>"
for _, header in ipairs(headers) do
html = html .. "<th>" .. tostring(header) .. "</th>"
end
html = html .. "</tr></thead><tbody>"
for _, row in ipairs(rows) do
html = html .. "<tr>"
for _, cell in ipairs(row) do
@@ -205,7 +223,7 @@ function M.table(headers, rows)
end
html = html .. "</tr>"
end
html = html .. "</tbody></table>"
return html
end
@@ -215,7 +233,24 @@ function M.copyright()
end
function M.highlight(str)
str = str or ""
return '<span class="highlight">' .. str .. "</span>"
end
function M.banner(str)
str = str or ""
return '<div class="banner">' .. str .. "</div>"
end
function M.center(str)
str = str or ""
return '<div class="center">' .. str .. "</div>"
end
function M.nav(link, str)
link = link or "example.com"
str = str or link
return '<a class="nav" href="' .. link .. '">' .. str .. "</a>"
end
return M