Module:Pagetype
Appearance
local dts = require('Module:User:Anomie/deepToString').deepToString -- for debugging
local yesno = require('Module:Yesno')
local p = {}
local defaultPagetypes = {
}
function p._main2(args)
local module = yesno(args.module)
if module == true then
module = 'module'
end
end
function p._main()
return dts(mw.site.namespaces)
end
function p.main(frame)
-- If called via #invoke, use the args passed into the invoking template, or the args passed to #invoke if any exist.
-- Otherwise assume args are being passed directly in from the debug console or from another Lua module.
local origArgs
if frame == mw.getCurrentFrame() then
origArgs = frame:getParent().args
for k, v in pairs(frame.args) do
origArgs = frame.args
break
end
else
origArgs = frame
end
-- Trim whitespace and remove blank arguments.
local args = {}
for k, v in pairs(origArgs) do
if type(v) == 'string' then
v = mw.text.trim(v)
end
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
return p