From edf3d329c6757cfe62dc55bb31605094ae28bf8b Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sun, 14 Nov 2021 10:40:04 +0100 Subject: Fix list generation --- scripts/metadata_filter.lua | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index b6df703..4014db4 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua @@ -218,11 +218,9 @@ function generate_list(meta) end) elseif meta.depth == "3" then return meta.pages.all:map(function(cat) - return { - title = cat.title, - content = cat.content, - url = cat.url, - grid = cat.list_grid, + local items = pandoc.List() + + if cat.pages then items = cat.pages.all:flatMap(function(c) if c.pages then return c.pages.all:map(function(p) @@ -248,7 +246,15 @@ function generate_list(meta) }) return l end - end), + end) + end + + return { + title = cat.title, + content = cat.content, + url = cat.url, + grid = cat.list_grid, + items = items, } end) end -- cgit v1.2.3-70-g09d2