Jump to content

Module:Pagetype

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 23:48, 23 October 2013 (oops - try the right name this time). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

#invoke:documentation

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