Handle preformatted content.
This commit is contained in:
parent
b38a20361f
commit
f8a2bc4193
|
@ -59,10 +59,15 @@ while true do
|
||||||
if meta == "text/gemini" then
|
if meta == "text/gemini" then
|
||||||
-- Handle Geminimap
|
-- Handle Geminimap
|
||||||
links = {}
|
links = {}
|
||||||
|
preformatted = false
|
||||||
while true do
|
while true do
|
||||||
line, err = conn:receive("*l")
|
line, err = conn:receive("*l")
|
||||||
if line ~= nil then
|
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.sub(line,3,-1) -- Trim off =>
|
||||||
line = string.gsub(line,"^%s+","") -- Trim spaces
|
line = string.gsub(line,"^%s+","") -- Trim spaces
|
||||||
link_url, label = table.unpack(utils.split(line, "%s+", false, 2))
|
link_url, label = table.unpack(utils.split(line, "%s+", false, 2))
|
||||||
|
|
Loading…
Reference in New Issue