Module:UtilsPackage: Difference between revisions
Jump to navigation
Jump to search
PhantomCaleb (talk | contribs) No edit summary |
PhantomCaleb (talk | contribs) mNo edit summary |
||
Line 9: | Line 9: | ||
local submodule = require(submodulePage) | local submodule = require(submodulePage) | ||
for exportKey, export in pairs(submodule) do | for exportKey, export in pairs(submodule) do | ||
if | if module[exportKey] then | ||
mw.addWarning(string.format("Module conflict: <code>%s</code> is exported by more than one submodule.", exportKey)) | mw.addWarning(string.format("Module conflict: <code>%s</code> is exported by more than one submodule.", exportKey)) | ||
end | end | ||
module[exportKey] = export | if exportKey ~= "Documentation" and exportKey ~= "Schemas" then | ||
module[exportKey] = export | |||
end | |||
end | end | ||
moduleDoc[i] = { | moduleDoc[i] = { |
Revision as of 22:42, 25 April 2020
local p = {}
local utilsTable = require("Module:UtilsTable")
function p.submodules(submodules, sectionHeadings)
local module = {}
local moduleDoc = {}
for i, submodulePage in ipairs(submodules) do
local submodule = require(submodulePage)
for exportKey, export in pairs(submodule) do
if module[exportKey] then
mw.addWarning(string.format("Module conflict: <code>%s</code> is exported by more than one submodule.", exportKey))
end
if exportKey ~= "Documentation" and exportKey ~= "Schemas" then
module[exportKey] = export
end
end
moduleDoc[i] = {
heading = sectionHeadings and sectionHeadings[i],
section = submodulePage,
}
end
module.Documentation = { sections = moduleDoc }
return module
end
return p