Jump to content

Module:Sandbox/The Mol Man

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by The Mol Man (talk | contribs) at 18:59, 10 January 2015 (Created page with 'local p = {} function p.main(frame) local args = frame:getParent().args local params = { 1, 2, 3, 'e', 'u', 'ul', 'up', 'upl', 'p', 's', 'end', 'errend', '+er...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local p = {}

function p.main(frame)
	local args = frame:getParent().args
	local params = { 1, 2, 3, 'e', 'u', 'ul', 'up', 'upl', 'p', 's', 'end', 'errend', '+errend', '-errend', 'fmt', 'nocategory' }
	local ret_t = {}
	for _, v in ipairs(params) do
		if args[v] then
			if type[v] == 'number' then
				table.insert(ret_t,'|')
				table.insert(ret_t,args[v])
			else
				table.insert(ret_t,'|'..args[v])
				table.insert(ret_t,args[v])
			end
		end
	end
	table.insert(ret_t,'}}')
	ret_t = table.concat(ret_t)
	local ret = mw.html.create('tr')
						:tag('td')
							:attr('rowspan','2')
							:wikitext('{{Val'..ret_t)
						:done()
						:tag('td')
							:attr('rowspan','2')
							:wikitext('→')
						:done()
						:tag('td')
							:wikitext(frame:preprocess('{{Val'..ret_t))
						:done()
					:done()
					:tag('tr')
						:tag('td')
							:wikitext(frame:preprocess('{{Val/sandbox'..ret_t))
						:done()
					:done()
				:done()
	return ret
end

return p