From 9af7a5cd80ad0f49817ffba517f5e6220cb329f2 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Wed, 11 Jan 2023 15:47:57 +0100 Subject: Update --- scripts/page.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'scripts/page.lua') diff --git a/scripts/page.lua b/scripts/page.lua index f9f5742..72158a1 100644 --- a/scripts/page.lua +++ b/scripts/page.lua @@ -51,7 +51,7 @@ function d1_page_to_list_item(meta) } end -function d2_page_to_list_item(meta, with_category) +function d2_page_to_list_item(meta, unlisted, with_category) return { title = meta.title, subtitle = meta.subtitle, @@ -69,12 +69,13 @@ function d2_page_to_list_item(meta, with_category) icon = meta.icon, post_icon = meta.post_icon, indicator = meta.indicator, + unlisted = unlisted } end function cat_to_list_cat(meta, allItems) local limit = meta.list_limit or 9999 - local items = allItems:take(limit) + local items = allItems:filter(function (item) return not item.unlisted end):take(limit) local omitted = #allItems - #items local description = nil @@ -109,7 +110,7 @@ function generate_list(meta) if meta.depth == 2 then return meta.pages.all :map(function(cat) - local allItems = cat.pages.all:map(function(p) return d2_page_to_list_item(p, false) end) + local allItems = cat.pages.all:map(function(p) return d2_page_to_list_item(p, false, false) end) return cat_to_list_cat(cat, allItems) end) @@ -121,7 +122,7 @@ function generate_list(meta) :map(function(cat) local allItems = cat.pages.all:flatMap(function(c) if cat.list_flatten and c.depth ~= 0 then - return c.pages.all:map(function(p) return d2_page_to_list_item(p, true) end) + return c.pages.all:map(function(p) return d2_page_to_list_item(p, c.list_no_propagate, true) end) else return pandoc.List({ d1_page_to_list_item(c) }) end -- cgit v1.2.3-54-g00ecf