Some checks are pending
offline / test (push) Waiting to run
Module and model book cards now point at generated index.html/index.pdf instead of directory URLs that 404. WeasyPrint file:// annotations are mapped to https://zapier.georgelambert.org/ paths that exist. Developer module, architecture, and research snapshot links target published files.
20 lines
590 B
Lua
20 lines
590 B
Lua
-- Rewrite in-document links so catalog PDFs point at other PDFs, not .md/.html.
|
|
function Link(el)
|
|
local t = el.target or ""
|
|
if t:match("^https?://") and not t:match("zapier%.georgelambert%.org") then
|
|
return el
|
|
end
|
|
if t:match("^mailto:") or t:match("^#") then
|
|
return el
|
|
end
|
|
local path, frag = t:match("^(.-)(#.*)$")
|
|
if not path then
|
|
path, frag = t, ""
|
|
end
|
|
-- PDFs should follow other PDFs for markdown sources. Keep .html (indexes, sphinx).
|
|
if path:match("%.md$") then
|
|
path = path:gsub("%.md$", ".pdf")
|
|
el.target = path .. frag
|
|
end
|
|
return el
|
|
end
|