cleanup local links in gemini

This commit is contained in:
sejo 2022-03-28 15:28:42 -06:00
parent 4082e7cecd
commit ad88a46531
1 changed files with 4 additions and 3 deletions

View File

@ -217,11 +217,12 @@ function firstPass()
elseif string.match( line, "^=>") then -- LINKS
local dest, text = getLink( line )
if string.match( dest, "^%./") then --local links
local t = string.match( text, "^{(.-)}$" )
local cleantext = string.match( text, "^{(.-)}$" ) -- see if wikilink and clean
local htmldest = string.gsub( dest, "gmi", "html" )
if t ~= nil then -- wikilink
if cleantext ~= nil then -- wikilink
local close = closeTags()
out.web = string.format("%s<p><a href='%s' class='arrow'>%s</a></p>",close,htmldest,t)
out.web = string.format("%s<p><a href='%s' class='arrow'>%s</a></p>",close,htmldest,cleantext)
out.gem = string.format("=> %s %s",dest,cleantext)
elseif isImagePath( dest ) then -- images
local img = string.format('<img src="%s" alt="%s" loading="lazy"/>',dest,text)