From 5320823ae5775b1857ba232262cdeb06c4ffbb6b Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 17 Dec 2021 15:23:34 +0100 Subject: Use full image URLs in feeds --- scripts/subpages.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 scripts/subpages.lua (limited to 'scripts') 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 @@ +local path = require 'pandoc.path' + +local namespace = '' +local siteUrl = '' + +function meta(meta) + namespace = pandoc.utils.stringify(meta.namespace) + siteUrl = pandoc.utils.stringify(meta.site.url):gsub("/$", "") +end + +function image(el) + if path.is_relative(el.src) then el.src = siteUrl .. path.join({ namespace, el.src }) end + + return el +end + +function link(el) + if path.is_relative(el.target) then + el.target = siteUrl .. path.join({ namespace, el.target }) + end + + return el +end + +return { { Meta = meta }, { Image = image, Link = link } } -- cgit v1.2.3-54-g00ecf