Browse Source

Handle preformatted content.

master
Solderpunk 1 year ago
parent
commit
f8a2bc4193
  1. 7
      gemini-demo.lua

7
gemini-demo.lua

@ -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))

Loading…
Cancel
Save