Compare commits

..

2 Commits

Author SHA1 Message Date
vx-clutch
7a6625fea7 First version of Gemini formatting 2026-03-01 21:51:37 -05:00
vx-clutch
6b87f3794b Update todos 2026-03-01 21:51:27 -05:00
5 changed files with 15 additions and 16 deletions

View File

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

View File

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

View File

@@ -93,6 +93,7 @@ func render(luapath string, requestData reqData, protocol Protocols) ([]byte, er
return "http" return "http"
} }
}() }()
proto = "gemini"
stdTbl.RawSetString("proto", lua.LString(proto)) stdTbl.RawSetString("proto", lua.LString(proto))
tbl.RawSetString("std", stdTbl) tbl.RawSetString("std", stdTbl)

View File

@@ -33,11 +33,8 @@ int main() {
"Item 3", "Item 3",
}, },
std.h(2, "Blockquotes"), std.h(2, "Blockquotes"),
std.blockquote([[ std.blockquote([["UNIX is very simple" - Dennis Ritchie
"UNIX is very simple" - Dennis Ritchie "GNU's Not UNIX" - Richard Stallman]]),
<br>
"GNU's Not UNIX" - Richard Stallman
]]),
std.h(2, "Rules"), std.h(2, "Rules"),
std.rule(), std.rule(),
std.h(2, "Images"), std.h(2, "Images"),

6
todo
View File

@@ -1,4 +1,2 @@
* Fix Gemini rendering gemini: Add command-line options
* Add Gemini command-line options http: https://git.erock.io
* Better gemini errors
* Fix build steps newlines