diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/metadata_filter.lua | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index 9125696..26d2423 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua | |||
@@ -108,14 +108,14 @@ function prep_menu(active_id, main_menu) | |||
108 | return { items = items, active = active_item } | 108 | return { items = items, active = active_item } |
109 | end | 109 | end |
110 | 110 | ||
111 | function process_pages(global, parent, order, pages_by_id) | 111 | function process_pages(global, order, pages_by_id) |
112 | if not pages_by_id then return nil end | 112 | if not pages_by_id then return nil end |
113 | 113 | ||
114 | local pages_all = pandoc.List() | 114 | local pages_all = pandoc.List() |
115 | local pages_date_desc = pandoc.List() | 115 | local pages_date_desc = pandoc.List() |
116 | 116 | ||
117 | for _, page in pairs(pages_by_id) do | 117 | for _, page in pairs(pages_by_id) do |
118 | local p = process(global, parent, page) | 118 | local p = process(global, page) |
119 | if not p.unlisted then | 119 | if not p.unlisted then |
120 | pages_all:insert(p) | 120 | pages_all:insert(p) |
121 | if p.date then pages_date_desc:insert(p) end | 121 | if p.date then pages_date_desc:insert(p) end |
@@ -284,7 +284,7 @@ function generate_list(meta) | |||
284 | end | 284 | end |
285 | end | 285 | end |
286 | 286 | ||
287 | function process(global, parent, meta) | 287 | function process(global, meta) |
288 | meta.namespace = resolve_namespace(meta.namespace) | 288 | meta.namespace = resolve_namespace(meta.namespace) |
289 | meta.file_out = pandoc.utils.stringify(meta.file_out):gsub("^out", "") | 289 | meta.file_out = pandoc.utils.stringify(meta.file_out):gsub("^out", "") |
290 | meta.redirect = meta.url and true | 290 | meta.redirect = meta.url and true |
@@ -318,8 +318,7 @@ function process(global, parent, meta) | |||
318 | meta.menus.main = prep_menu(meta.namespace.root.id, meta.menus.main) | 318 | meta.menus.main = prep_menu(meta.namespace.root.id, meta.menus.main) |
319 | end | 319 | end |
320 | 320 | ||
321 | meta.pages = | 321 | meta.pages = process_pages(global, meta.list_order, meta.pages) |
322 | process_pages(global, { parent = parent, meta = meta }, meta.list_order, meta.pages) | ||
323 | meta.depth = (meta.pages and find_depth(meta.pages.all)) or "0" | 322 | meta.depth = (meta.pages and find_depth(meta.pages.all)) or "0" |
324 | meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or | 323 | meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or |
325 | resolve_layout(meta.depth)) | 324 | resolve_layout(meta.depth)) |
@@ -346,5 +345,5 @@ end | |||
346 | function Meta(meta) | 345 | function Meta(meta) |
347 | meta.site.url = pandoc.utils.stringify(meta.site.url):gsub("/$", "") | 346 | meta.site.url = pandoc.utils.stringify(meta.site.url):gsub("/$", "") |
348 | 347 | ||
349 | return process(meta, nil, meta) | 348 | return process(meta, meta) |
350 | end | 349 | end |