Module:Asbox

local WRAPPER_TEMPLATE = 'Template:Asbox'

local p = {}

function p.main(frame) local args = require('Module:Arguments').getArgs(frame, {		wrappers = WRAPPER_TEMPLATE	}) local output = mw.html.create('table') local page = mw.title.getCurrentTitle

local buffer = mw.html.create('td') output :addClass('metadata plainlinks stub') :css('background','transparent') :attr('role','presentation') if args.icon or args.image then output :tag('td'):wikitext(args.icon or string.format( '',				args.image, args.pix and ('|' .. args.pix) or '40x30', args.imagealt or 'Stub icon' ))	end buffer :tag('i') :wikitext(string.format( 'This %s %s %s is a stub. You can help Wikipedia by [%s expanding it].', args.subject or '', args.article or 'article', args.qualifier or '', page:fullUrl('action=edit', 'relative') ))	if args.name then buffer :wikitext(require('Module:Navbar')._navbar{				args.name,				mini = 'yes',				style = 'position: absolute; right: 15px; display: none;'			}) end if args.note then buffer :wikitext(' ') :tag('span') :css('font-style', 'normal') :css('font-size', 'smaller') :wikitext(args.note) end output :node(buffer) output = tostring(output) if page.namespace == 0 then -- Main namespace output = output .. ''		-- Instead of this loop, you should match all arg names that are category and then a number. for k = 0,2 do if args['category' .. (k > 0 and k or '')] then output = string.format('%s', output, args['category' .. (k > 0 and k or '')]) end end end if args.name and not args.demo and page.basePageTitle ~= WRAPPER_TEMPLATE then local nameTitle = mw.title.new(args.name) if not nameTitle then error("invalid page name in 'name' argument", 2) elseif nameTitle == page.prefixedText then output = output .. frame:expandTemplate{ title = 'Asbox/templatepage', args = args }		elseif not nameTitle.isSubpage and nameTitle.namespace == 10 then -- Template namespace and not a subpage output = output .. string.format(				'',				(args.name and 'E' or 'W') .. page.text			) end end return output end

return p