From 10a6c510f6f92ce44a063f5e0edf206ee9d9ce4d Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 11 May 2025 17:19:58 -0700 Subject: create catchall categories --- main.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/main.lua b/main.lua index 3cb55ec..fd6f75b 100644 --- a/main.lua +++ b/main.lua @@ -76,10 +76,26 @@ local function add_object(obj) obj.children = {} end - if not obj.parent_id or not objects[obj.parent_id] then + if not obj.parent_id then return end + -- dump any objects referencing nonexistent categories into a single + -- catchall category + if not objects[obj.parent_id] then + obj.parent_id = obj.section .. ':category:catchall' + if not objects[obj.parent_id] then + add_object({ + section=obj.section, + type='group', + group_type='category', + id=obj.parent_id, + parent_id=obj.section .. ':category:0', + name='*CATCHALL*', + }) + end + end + local parent_children = objects[obj.parent_id].children parent_children[#parent_children+1] = obj end -- cgit v1.2.3-70-g09d2