summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/metadata_filter.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua
index 314f2b0..cb060fa 100644
--- a/scripts/metadata_filter.lua
+++ b/scripts/metadata_filter.lua
@@ -185,10 +185,11 @@ function d1_page_to_list_item(meta, p)
185 } 185 }
186end 186end
187 187
188function d2_page_to_list_item(meta, cat, p) 188function d2_page_to_list_item(meta, cat, p, set_cat_title)
189 return { 189 return {
190 title = p.title, 190 title = p.title,
191 subtitle = p.subtitle, 191 subtitle = p.subtitle,
192 category = set_cat_title and cat.title,
192 date = p.date, 193 date = p.date,
193 position = p.position, 194 position = p.position,
194 url = p.url, 195 url = p.url,
@@ -229,7 +230,7 @@ function generate_list(meta)
229 return meta.pages.all 230 return meta.pages.all
230 :map(function(cat) 231 :map(function(cat)
231 local allItems = ((cat.pages and cat.pages.all) or pandoc.List()) 232 local allItems = ((cat.pages and cat.pages.all) or pandoc.List())
232 :map(function(p) return d2_page_to_list_item(meta, cat, p) end) 233 :map(function(p) return d2_page_to_list_item(meta, cat, p, false) end)
233 234
234 return cat_to_list_cat(cat, allItems) 235 return cat_to_list_cat(cat, allItems)
235 end) 236 end)
@@ -241,7 +242,7 @@ function generate_list(meta)
241 :map(function(cat) 242 :map(function(cat)
242 local allItems = (cat.pages and cat.pages.all or pandoc.List()):flatMap(function(c) 243 local allItems = (cat.pages and cat.pages.all or pandoc.List()):flatMap(function(c)
243 if c.pages then 244 if c.pages then
244 return c.pages.all:map(function(p) return d2_page_to_list_item(cat, c, p) end) 245 return c.pages.all:map(function(p) return d2_page_to_list_item(cat, c, p, true) end)
245 else 246 else
246 return pandoc.List({ d1_page_to_list_item(cat, c) }) 247 return pandoc.List({ d1_page_to_list_item(cat, c) })
247 end 248 end