From 84dcb995a86e5fcd904bd31a692492768ddefdc1 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Mon, 27 Dec 2021 13:35:27 +0100 Subject: Simplified thumbnails --- scripts/metadata_filter.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index b16ab92..413ded5 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua @@ -19,6 +19,15 @@ function pandoc.List:take(n) return result end +function file_exists(name) + local f = io.open(name, "r") + if f ~= nil then + io.close(f) + return true + end + return false +end + function format_date(date) if not date then return date end @@ -297,7 +306,8 @@ function process(global, meta) end if meta.thumbnail then - meta.thumbnail = make_absolute(pandoc.utils.stringify(meta.thumbnail), meta.file_out) + meta.thumbnail = make_absolute("thumbnail." .. pandoc.utils.stringify(meta.thumbnail), + meta.file_out) meta.thumbnail = resolve_url(global.site.url, global.file_out, meta.thumbnail) end -- cgit v1.2.3-70-g09d2