summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/subpages.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/subpages.lua b/scripts/subpages.lua
new file mode 100644
index 0000000..95f68f5
--- /dev/null
+++ b/scripts/subpages.lua
@@ -0,0 +1,25 @@
1local path = require 'pandoc.path'
2
3local namespace = ''
4local siteUrl = ''
5
6function meta(meta)
7 namespace = pandoc.utils.stringify(meta.namespace)
8 siteUrl = pandoc.utils.stringify(meta.site.url):gsub("/$", "")
9end
10
11function image(el)
12 if path.is_relative(el.src) then el.src = siteUrl .. path.join({ namespace, el.src }) end
13
14 return el
15end
16
17function link(el)
18 if path.is_relative(el.target) then
19 el.target = siteUrl .. path.join({ namespace, el.target })
20 end
21
22 return el
23end
24
25return { { Meta = meta }, { Image = image, Link = link } }