diff options
| author | Volpeon <git@volpeon.ink> | 2022-08-04 10:26:57 +0200 |
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2022-08-04 10:26:57 +0200 |
| commit | 347d7c0da13079fefce6d8741a5604adb89eb97c (patch) | |
| tree | 43b568e5ae48692425a9ddeeddc4001b1e940336 /scripts/pages_content.lua | |
| parent | Code reorganization (diff) | |
| download | volpeon.ink-347d7c0da13079fefce6d8741a5604adb89eb97c.tar.gz volpeon.ink-347d7c0da13079fefce6d8741a5604adb89eb97c.tar.bz2 volpeon.ink-347d7c0da13079fefce6d8741a5604adb89eb97c.zip | |
Overhauled metadata handling
Diffstat (limited to 'scripts/pages_content.lua')
| -rw-r--r-- | scripts/pages_content.lua | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/scripts/pages_content.lua b/scripts/pages_content.lua deleted file mode 100644 index b753b1e..0000000 --- a/scripts/pages_content.lua +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | local path = require 'pandoc.path' | ||
| 2 | |||
| 3 | local namespace = '' | ||
| 4 | local siteUrl = '' | ||
| 5 | |||
| 6 | function meta(meta) | ||
| 7 | namespace = pandoc.utils.stringify(meta.namespace.full) | ||
| 8 | siteUrl = pandoc.utils.stringify(meta.site.url):gsub("/$", "") | ||
| 9 | end | ||
| 10 | |||
| 11 | function image(el) | ||
| 12 | if path.is_relative(el.src) and not el.src:match("^https?://") then | ||
| 13 | el.src = siteUrl .. path.join({ namespace, el.src }) | ||
| 14 | end | ||
| 15 | |||
| 16 | return el | ||
| 17 | end | ||
| 18 | |||
| 19 | function link(el) | ||
| 20 | if path.is_relative(el.target) and not el.target:match("^https?://") then | ||
| 21 | el.target = siteUrl .. path.join({ namespace, el.target }) | ||
| 22 | end | ||
| 23 | |||
| 24 | return el | ||
| 25 | end | ||
| 26 | |||
| 27 | return { { Meta = meta }, { Image = image, Link = link } } | ||
