blob: b753b1e42d93757582b403a6d22c7999900b4b32 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
local path = require 'pandoc.path'
local namespace = ''
local siteUrl = ''
function meta(meta)
namespace = pandoc.utils.stringify(meta.namespace.full)
siteUrl = pandoc.utils.stringify(meta.site.url):gsub("/$", "")
end
function image(el)
if path.is_relative(el.src) and not el.src:match("^https?://") then
el.src = siteUrl .. path.join({ namespace, el.src })
end
return el
end
function link(el)
if path.is_relative(el.target) and not el.target:match("^https?://") then
el.target = siteUrl .. path.join({ namespace, el.target })
end
return el
end
return { { Meta = meta }, { Image = image, Link = link } }
|