diff options
author | garret <garret@airmail.cc> | 2022-11-26 11:12:49 +0000 |
---|---|---|
committer | garret <garret@airmail.cc> | 2022-11-26 11:12:49 +0000 |
commit | 0e8df90aad470a84f2b1b028e5e10f49d4ccfb46 (patch) | |
tree | 68828d223f5e03b1679e5f334602e67986190c60 | |
parent | 59a6c25df5ad62accebaa69684429ccd3963a946 (diff) | |
download | depctrl-feedmaker-0e8df90aad470a84f2b1b028e5e10f49d4ccfb46.tar.gz depctrl-feedmaker-0e8df90aad470a84f2b1b028e5e10f49d4ccfb46.tar.bz2 depctrl-feedmaker-0e8df90aad470a84f2b1b028e5e10f49d4ccfb46.zip |
feedmaker: don't add the macros/modules table if nothing's in it
causes problems with depctrl-browser
-rwxr-xr-x | make-feed.lua | 33 |
1 files 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 |