Module:Exports
Jump to navigation
Jump to search
local p = {}
local TableTools = require('Module:TableTools')
local getArgs = require('Module:Arguments').getArgs
function p.exports(frame)
local args = getArgs(frame)
local title = args[1] or mw.title.getCurrentTitle().fullText
local moduleExports = require(title)
local keys = TableTools.keysToList(moduleExports, function (a, b)
return string.lower(a) < string.lower(b)
end)
local outputKeys = {}
for _, v in ipairs(keys) do
if not args.exclude or not v:match(args.exclude) then
table.insert(outputKeys, '<code><span style="white-space: pre;">' .. v .. '</span></code>')
end
end
return mw.text.listToText(outputKeys)
end
return p