summaryrefslogtreecommitdiffstats
path: root/scripts/page.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/page.lua')
-rw-r--r--scripts/page.lua9
1 files changed, 5 insertions, 4 deletions
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)
51 } 51 }
52end 52end
53 53
54function d2_page_to_list_item(meta, with_category) 54function d2_page_to_list_item(meta, unlisted, with_category)
55 return { 55 return {
56 title = meta.title, 56 title = meta.title,
57 subtitle = meta.subtitle, 57 subtitle = meta.subtitle,
@@ -69,12 +69,13 @@ function d2_page_to_list_item(meta, with_category)
69 icon = meta.icon, 69 icon = meta.icon,
70 post_icon = meta.post_icon, 70 post_icon = meta.post_icon,
71 indicator = meta.indicator, 71 indicator = meta.indicator,
72 unlisted = unlisted
72 } 73 }
73end 74end
74 75
75function cat_to_list_cat(meta, allItems) 76function cat_to_list_cat(meta, allItems)
76 local limit = meta.list_limit or 9999 77 local limit = meta.list_limit or 9999
77 local items = allItems:take(limit) 78 local items = allItems:filter(function (item) return not item.unlisted end):take(limit)
78 local omitted = #allItems - #items 79 local omitted = #allItems - #items
79 80
80 local description = nil 81 local description = nil
@@ -109,7 +110,7 @@ function generate_list(meta)
109 if meta.depth == 2 then 110 if meta.depth == 2 then
110 return meta.pages.all 111 return meta.pages.all
111 :map(function(cat) 112 :map(function(cat)
112 local allItems = cat.pages.all:map(function(p) return d2_page_to_list_item(p, false) end) 113 local allItems = cat.pages.all:map(function(p) return d2_page_to_list_item(p, false, false) end)
113 114
114 return cat_to_list_cat(cat, allItems) 115 return cat_to_list_cat(cat, allItems)
115 end) 116 end)
@@ -121,7 +122,7 @@ function generate_list(meta)
121 :map(function(cat) 122 :map(function(cat)
122 local allItems = cat.pages.all:flatMap(function(c) 123 local allItems = cat.pages.all:flatMap(function(c)
123 if cat.list_flatten and c.depth ~= 0 then 124 if cat.list_flatten and c.depth ~= 0 then
124 return c.pages.all:map(function(p) return d2_page_to_list_item(p, true) end) 125 return c.pages.all:map(function(p) return d2_page_to_list_item(p, c.list_no_propagate, true) end)
125 else 126 else
126 return pandoc.List({ d1_page_to_list_item(c) }) 127 return pandoc.List({ d1_page_to_list_item(c) })
127 end 128 end