From d44dd387d8f553791671f52f691be7580b98c6db Mon Sep 17 00:00:00 2001 From: Vhyrro Date: Sun, 7 Jan 2024 13:07:10 +0100 Subject: [PATCH] fix(docgen): make the wiki work again --- docgen/init.lua | 21 ++++++++++++++------- docgen/minimal_init.vim | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/docgen/init.lua b/docgen/init.lua index 3ae4852a0..d26e01758 100644 --- a/docgen/init.lua +++ b/docgen/init.lua @@ -66,21 +66,28 @@ for _, file in ipairs(docgen.aggregate_module_files()) do local ok, parsed_module = pcall(dofile, fullpath) if not ok then - vim.notify("Error when sourcing module '" .. file .. ": " .. parsed_module) + vim.notify("Error when sourcing module '" .. file .. "': " .. parsed_module) goto continue end -- Make Neorg load the module, which also evaluates dependencies - modules.load_module(parsed_module.name) + local _ok, err = pcall(modules.load_module, parsed_module.name) + + if not _ok then + vim.notify("Error when loading module '" .. file .. "': " .. err) + goto continue + end -- Retrieve the module from the `loaded_modules` table. parsed_module = modules.loaded_modules[parsed_module.name] - doc_modules[parsed_module.name] = { - top_comment_data = top_comment_data, - buffer = buffer, - parsed = parsed_module, - } + if parsed_module then + doc_modules[parsed_module.name] = { + top_comment_data = top_comment_data, + buffer = buffer, + parsed = parsed_module, + } + end ::continue:: end diff --git a/docgen/minimal_init.vim b/docgen/minimal_init.vim index b1d3ce0ef..d965217b8 100644 --- a/docgen/minimal_init.vim +++ b/docgen/minimal_init.vim @@ -26,6 +26,6 @@ package.path = "../nvim-treesitter/lua/?.lua;" .. package.path vim.cmd.TSInstallSync({ bang = true, - args = { "lua" }, + args = { "lua", "norg" }, }) EOF