Compare commits
2 Commits
865e22deb7
...
7a6625fea7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a6625fea7 | ||
|
|
6b87f3794b |
@@ -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")
|
||||
|
||||
14
lib/std.lua
14
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 "<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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -33,11 +33,8 @@ int main() {
|
||||
"Item 3",
|
||||
},
|
||||
std.h(2, "Blockquotes"),
|
||||
std.blockquote([[
|
||||
"UNIX is very simple" - Dennis Ritchie
|
||||
<br>
|
||||
"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"),
|
||||
|
||||
Reference in New Issue
Block a user