From 2aeea2082f8fbb36f503c508a08491c4a550f6ed Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 20 Nov 2021 12:57:00 +0100 Subject: Improved list category descriptions --- scripts/metadata_filter.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index c154708..9125696 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua @@ -210,7 +210,8 @@ function generate_list(meta) end) elseif meta.depth == "2" then return meta.pages.all:map(function(cat) - local limit = (cat.list_limit and tonumber(pandoc.utils.stringify(cat.list_limit))) or 9999 + local limit = (cat.list_limit and tonumber(pandoc.utils.stringify(cat.list_limit))) or + 9999 local allItems = ((cat.pages and cat.pages.all) or pandoc.List()):map(function(p) return { title = p.title, @@ -227,7 +228,8 @@ function generate_list(meta) return { title = cat.title, - content = cat.content, + description = (cat.description and pandoc.MetaBlocks(pandoc.Para(cat.description))) or + (not cat.no_description and cat.content), url = cat.url, grid = cat.list_grid, items = items, @@ -237,7 +239,8 @@ function generate_list(meta) end):filter(function(cat) return #cat.items ~= 0 end) elseif meta.depth == "3" then return meta.pages.all:map(function(cat) - local limit = (cat.list_limit and tonumber(pandoc.utils.stringify(cat.list_limit))) or 9999 + local limit = (cat.list_limit and tonumber(pandoc.utils.stringify(cat.list_limit))) or + 9999 local allItems = (cat.pages and cat.pages.all or pandoc.List()):flatMap(function(c) if c.pages then return c.pages.all:map(function(p) @@ -269,7 +272,8 @@ function generate_list(meta) return { title = cat.title, - content = cat.content, + description = (cat.description and pandoc.MetaBlocks(pandoc.Para(cat.description))) or + (not cat.no_description and cat.content), url = cat.url, grid = cat.list_grid, items = items, -- cgit v1.2.3-70-g09d2