diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/metadata_filter.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index 3bea687..daad940 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua | |||
@@ -89,18 +89,17 @@ end | |||
89 | 89 | ||
90 | function prep_menu(active_id, main_menu) | 90 | function prep_menu(active_id, main_menu) |
91 | local active_item = nil | 91 | local active_item = nil |
92 | local items = pandoc.List() | ||
92 | 93 | ||
93 | for i = 1, #main_menu do | 94 | for i = 1, #main_menu do |
94 | local item = main_menu[i] | 95 | local item = main_menu[i] |
95 | local active = pandoc.utils.stringify(item.id) == active_id | 96 | local active = pandoc.utils.stringify(item.id) == active_id |
96 | item.active = active | 97 | item.active = active |
97 | if active then active_item = item end | 98 | if active then active_item = item end |
99 | if not item.hidden or item.active then items:insert(item) end | ||
98 | end | 100 | end |
99 | 101 | ||
100 | return { | 102 | return { items = items, active = active_item } |
101 | items = main_menu:filter(function(item) return not item.hidden or item.active end), | ||
102 | active = active_item, | ||
103 | } | ||
104 | end | 103 | end |
105 | 104 | ||
106 | function process_pages(global, pages_by_id) | 105 | function process_pages(global, pages_by_id) |