From e913e6d236bd1e967abb78f0eb1a6dcea647e9ba Mon Sep 17 00:00:00 2001 From: urosm Date: Sat, 3 Aug 2024 15:57:46 +0200 Subject: [PATCH] update pandoc filters --- pandoc/filters/collect_internal_linked.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pandoc/filters/collect_internal_linked.lua b/pandoc/filters/collect_internal_linked.lua index 9477cb9..a57fa44 100644 --- a/pandoc/filters/collect_internal_linked.lua +++ b/pandoc/filters/collect_internal_linked.lua @@ -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