From bf36287607cbe7d5d3e393943b0b79e3d2c4b113 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 5 Aug 2022 07:45:30 +0200 Subject: Stricter pruning, don't pre-calculate description field --- scripts/page.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'scripts/page.lua') diff --git a/scripts/page.lua b/scripts/page.lua index 4eeebb2..f3802a2 100644 --- a/scripts/page.lua +++ b/scripts/page.lua @@ -79,7 +79,8 @@ function cat_to_list_cat(meta, allItems) return { title = meta.title, - description = meta.description, + description = (meta.description and pandoc.MetaBlocks(pandoc.Para(meta.description))) or + (not meta.no_description and meta.content), last_update = meta.last_update, schema_type = meta.schema_type, url = meta.url, @@ -191,23 +192,22 @@ function process(global, build, meta, dir) end end -function prune_pages(meta, n) - if n == 0 then - meta.pages = { - all = pandoc.List(), - date_desc = pandoc.List(), - random = pandoc.List(), - by_id = {} - } +function prune_pages(meta, up, down) + meta.pages.random = pandoc.List() + meta.pages.by_id = {} + + if down == 0 then + meta.pages.all = pandoc.List() + meta.pages.date_desc = pandoc.List() else for _, p in pairs(meta.pages.by_id) do - prune_pages(p, n - 1) + prune(p, up, down - 1) end end end function prune(meta, up, down) - prune_pages(meta, down) + prune_pages(meta, up, down) if up == 0 then meta.parent = nil -- cgit v1.2.3-70-g09d2