diff --git a/lib/fes.lua b/lib/fes.lua index fd5c549..9d304cd 100644 --- a/lib/fes.lua +++ b/lib/fes.lua @@ -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") diff --git a/lib/std.lua b/lib/std.lua index fa3409c..637759f 100644 --- a/lib/std.lua +++ b/lib/std.lua @@ -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 "" .. s .. "" 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 "
" .. s .. "
" 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 "
" .. text .. "
" 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 "
" .. text .. "
" elseif isGemini() then - return text .. "\n" + return text end end diff --git a/modules/server/render.go b/modules/server/render.go index 95422cc..b1d77b4 100644 --- a/modules/server/render.go +++ b/modules/server/render.go @@ -93,6 +93,7 @@ func render(luapath string, requestData reqData, protocol Protocols) ([]byte, er return "http" } }() + proto = "gemini" stdTbl.RawSetString("proto", lua.LString(proto)) tbl.RawSetString("std", stdTbl) diff --git a/test/www/index.lua b/test/www/index.lua index 0e17c10..79dfcc9 100644 --- a/test/www/index.lua +++ b/test/www/index.lua @@ -33,11 +33,8 @@ int main() { "Item 3", }, std.h(2, "Blockquotes"), - std.blockquote([[ -"UNIX is very simple" - Dennis Ritchie -
-"GNU's Not UNIX" - Richard Stallman -]]), + std.blockquote([["UNIX is very simple" - Dennis Ritchie +"GNU's Not UNIX" - Richard Stallman]]), std.h(2, "Rules"), std.rule(), std.h(2, "Images"),