mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
Fix README.md so that relative links from manual become absolute.
Previously they'd be broken links when viewed on GitHub or Hackage. So we add the base URL for the pandoc manual.
This commit is contained in:
+15
-9
@@ -8,15 +8,21 @@ f:close()
|
||||
result = {}
|
||||
|
||||
function Div(elem)
|
||||
local ident = elem.identifier or ""
|
||||
local get = function(el)
|
||||
if el.identifier == ident then
|
||||
result = el
|
||||
end
|
||||
end
|
||||
if ident == 'input-formats' or ident == 'output-formats' then
|
||||
pandoc.walk_block(pandoc.Div(mdoc.blocks), { Div = get })
|
||||
return result
|
||||
local ident = elem.identifier or ""
|
||||
local fixrel = function(el)
|
||||
if el.target:match("^#") then
|
||||
el.target = "https://pandoc.org/MANUAL.html" .. el.target
|
||||
end
|
||||
return el
|
||||
end
|
||||
local get = function(el)
|
||||
if el.identifier == ident then
|
||||
result = pandoc.walk_block(el, { Link = fixrel })
|
||||
end
|
||||
end
|
||||
if ident == 'input-formats' or ident == 'output-formats' then
|
||||
pandoc.walk_block(pandoc.Div(mdoc.blocks), { Div = get })
|
||||
return result
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user