From 0e8df90aad470a84f2b1b028e5e10f49d4ccfb46 Mon Sep 17 00:00:00 2001 From: garret Date: Sat, 26 Nov 2022 11:12:49 +0000 Subject: feedmaker: don't add the macros/modules table if nothing's in it causes problems with depctrl-browser --- make-feed.lua | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/make-feed.lua b/make-feed.lua index 38c23f5..ff3e46e 100755 --- a/make-feed.lua +++ b/make-feed.lua @@ -184,24 +184,29 @@ local function make_feed(meta) url = config.url, maintainer = config.maintainer, fileBaseUrl = config.fileBaseUrl, - macros = {}, - modules = {} +-- macros = {}, +-- modules = {} } - for _, script in ipairs(meta.macros) do - local macro, feeds = get_feed_entry(script) - feed.knownFeeds = join_ktables(feed.knownFeeds, feeds) - feed.macros[script.namespace] = macro + if next(meta.macros) then + config.macros.ignoreCondition = nil + feed.macros = join_ktables(feed.macros, config.macros) -- remove the ignore functions so they don't cause problems with the json conversion + for _, script in ipairs(meta.macros) do + local macro, feeds = get_feed_entry(script) + feed.knownFeeds = join_ktables(feed.knownFeeds, feeds) + feed.macros[script.namespace] = macro + end end - for _, script in ipairs(meta.modules) do - local mod, feeds = get_feed_entry(script) - feed.knownFeeds = join_ktables(feed.knownFeeds, feeds) - feed.modules[script.namespace] = mod + + if next(meta.modules) then + config.modules.ignoreCondition = nil + feed.modules = join_ktables(feed.modules, config.modules) + for _, script in ipairs(meta.modules) do + local mod, feeds = get_feed_entry(script) + feed.knownFeeds = join_ktables(feed.knownFeeds, feeds) + feed.modules[script.namespace] = mod + end end - config.macros.ignoreCondition = nil config.modules.ignoreCondition = nil - -- remove the functions so they don't cause problems with the json conversion - feed.macros = join_ktables(feed.macros, config.macros) - feed.modules = join_ktables(feed.modules, config.modules) return json.encode(feed) end -- cgit v1.2.3-70-g09d2