Handle preformatted content.

This commit is contained in:
Solderpunk 2020-03-07 20:29:47 +01:00
parent b38a20361f
commit f8a2bc4193
1 changed files with 6 additions and 1 deletions

View File

@ -59,10 +59,15 @@ while true do
if meta == "text/gemini" then
-- Handle Geminimap
links = {}
preformatted = false
while true do
line, err = conn:receive("*l")
if line ~= nil then
if string.sub(line,1,2) == "=>" then
if string.sub(line,1,3) == "```" then
preformatted = not preformatted
elseif preformatted then
io.write(line .. "\n")
elseif string.sub(line,1,2) == "=>" then
line = string.sub(line,3,-1) -- Trim off =>
line = string.gsub(line,"^%s+","") -- Trim spaces
link_url, label = table.unpack(utils.split(line, "%s+", false, 2))