update pandoc filters
parent
0c9b6ee4c0
commit
e913e6d236
|
@ -8,18 +8,19 @@ local visited = {}
|
|||
|
||||
return {
|
||||
{ Link = function(link)
|
||||
-- early return for visited
|
||||
if visited[link.target] then return end
|
||||
visited[link.target] = true
|
||||
|
||||
-- early return for external links
|
||||
if link.target:find("^https?%:%/%/") then return end
|
||||
if link.target:find("^mailto%:") then return end
|
||||
|
||||
local fp, anchor = link.target:match("^(.+%.md)#?(.*)$")
|
||||
|
||||
-- early return for non markdown files
|
||||
if not fp then return end
|
||||
|
||||
-- early return for visited
|
||||
if visited[fp] then return end
|
||||
visited[fp] = true
|
||||
|
||||
local f = io.open(fp)
|
||||
-- early return for broken internal links
|
||||
if f == nil then return link.content else f:close() end -- @todo maybe log broken internal links
|
||||
|
|
Loading…
Reference in New Issue