doc: first

This commit is contained in:
2025-12-14 19:40:55 -05:00
parent 3cfc9b4aed
commit 1427d0d780
5 changed files with 507 additions and 45 deletions

View File

@@ -186,46 +186,6 @@ function M.site_authors()
return {}
end
-- Join array with separator
function M.join(arr, sep)
arr = arr or {}
sep = sep or ", "
local result = {}
for _, v in ipairs(arr) do
table.insert(result, tostring(v))
end
return table.concat(result, sep)
end
-- Trim whitespace
function M.trim(str)
str = tostring(str or "")
return str:match("^%s*(.-)%s*$")
end
-- Table HTML generator
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
html = html .. "<td>" .. tostring(cell) .. "</td>"
end
html = html .. "</tr>"
end
html = html .. "</tbody></table>"
return html
end
function M.highlight(str)
return '<span class="highlight">' .. (str or "") .. "</span>"
end