First version of Gemini formatting
This commit is contained in:
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user