Documentation for this module may be created at Module:T/doc

local p = {}
 
function p.main( frame )
	local a = frame:getParent().args
	local page = a[1]
	if not page then return '' end

	local prefix = a.prefix and a.prefix .. ':' or ''
	local ns = 'Template:'

	-- Check Namespace
	if a.prefix == '#invoke' then
		ns = 'Module:'
	else
		local pageNs = page:match('^(.-):')
		if pageNs and ( pageNs == '' or mw.site.namespaces[pageNs] ) then
			ns = ''
		end
	end

	-- Build Output
	local out = { '{{',prefix,'[[',ns,page,'|',page,']]' }

	local i = 2
	while a[i] ~= nil do
		local arg = a[i]
		if arg then
			local f = arg:find('=')
			if f then
				out[#out+1] = '|' .. arg:sub(0,f) .. '<span style="color:#BDBDBD;">&lt;' .. arg:sub(f+1) .. '&gt;</span>'
			else
				out[#out+1] = '|<span style="color:#BDBDBD;">&lt;' .. arg .. '&gt;</span>'
			end
		end
		i = i + 1
	end
 
	out[#out+1] = '}}'
 
	if a.style == 'code' then
		out[1] = '<code>{{'
		out[#out+1] = '</code>'
	end
 
	return table.concat(out)
end
 
return p

-- [[Category:Modules]]