First version of Gemini formatting

This commit is contained in:
vx-clutch
2026-03-01 21:51:37 -05:00
parent 6b87f3794b
commit 7a6625fea7
4 changed files with 13 additions and 12 deletions

View File

@@ -99,6 +99,7 @@ local default_gemini_header = [[
]]
local default_gemini_footer = [[
=> https://git.vxserver.dev/fSD/fes Fes Powered
=> https://www.lua.org Lua Powered
=> https://git.vxserver.dev/fSD/fes/src/branch/main/LICENSE ISC Licensed
@@ -185,7 +186,7 @@ function M:build()
)
local header = self.header
return header .. table.concat(self.parts, "\n") .. "\n\n" .. footer
return header .. table.concat(self.parts, "\n") .. footer
end
return table.concat(self.parts, "\n")

View File

@@ -4,11 +4,13 @@ M.proto = "http"
M.__fes_banner_set = false
local function isHttp()
return M.proto == "http"
-- return M.proto == "http"
return false
end
local function isGemini()
return M.proto == "gemini"
-- return M.proto == "gemini"
return true
end
M.p = function(s)
@@ -28,7 +30,7 @@ M.h = function(level, s)
if isHttp() then
return "<h" .. level .. ">" .. s .. "</h" .. level .. ">"
elseif isGemini() then
return string.rep("#", level) .. " " .. s
return "\n" .. string.rep("#", level) .. " " .. s .. "\n"
end
end
@@ -88,7 +90,7 @@ M.blockquote = function(s)
if isHttp() then
return "<blockquote>" .. s .. "</blockquote>"
elseif isGemini() then
return "> " .. s
return "> " .. string.gsub(s, "\n", "\n> ")
end
end
@@ -125,7 +127,7 @@ M.note = function(text)
if isHttp() then
return "<div class=\"note\">" .. text .. "</div>"
elseif isGemini() then
return "\n\n" .. text .. "\n\n"
return "\n" .. text .. "\n"
end
end
@@ -141,7 +143,7 @@ M.banner = function (text)
if isHttp() then
return "<div class=\"banner\">" .. text .. "</div>"
elseif isGemini() then
return text .. "\n"
return text
end
end