From d8bda573008ab1f23e30cb4f1533468090e5dddb Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 10 Jan 2023 09:04:11 +0100 Subject: Better asset handling; paragraph fix for new Pandoc versions; updated emojis --- scripts/lib/common.lua | 7 +------ scripts/page.lua | 13 +++++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/lib/common.lua b/scripts/lib/common.lua index d3c6c44..055e783 100644 --- a/scripts/lib/common.lua +++ b/scripts/lib/common.lua @@ -20,12 +20,7 @@ function pandoc.List:flatten() end function pandoc.List:flatMap(fn) - local mapped = self:map(fn) - local result = pandoc.List() - - for i = 1, #mapped do result:extend(mapped[i]) end - - return result + return self:map(fn):flatten() end function pandoc.List:filterMap(fn) diff --git a/scripts/page.lua b/scripts/page.lua index 33982ba..606288a 100644 --- a/scripts/page.lua +++ b/scripts/page.lua @@ -77,10 +77,19 @@ function cat_to_list_cat(meta, allItems) local items = allItems:take(limit) local omitted = #allItems - #items + local description = nil + + if meta.description then + description = pandoc.Para(meta.description) + elseif not meta.no_description then + description = meta.content:filter(function (el) + return el.tag ~= "Str" or el.text ~= "ΒΆ" + end) + end + return { title = meta.title, - description = (meta.description and pandoc.MetaBlocks(pandoc.Para(meta.description))) or - (not meta.no_description and meta.content), + description = pandoc.MetaBlocks(description), last_update = meta.last_update, schema_type = meta.schema_type, url = meta.url, -- cgit v1.2.3-70-g09d2