Module:Infobox election/sandbox

local p = {} local args = {} local origArgs = {}

local function notblank(v) return (mw.text.trim(v or "") ~= "") end

function p.infobox(frame) for k,v in frame:getParent.args do		if notblank(v) then origArgs[k] = mw.text.trim(v) end end for k,v in frame.args do		if notblank(v) then origArgs[k] = mw.text.trim(v) end end local width = math.max(		(origArgs.map_image or origArgs.map) and (mw.ustring.match((origArgs.map_size or 300),"(%d*)")) or 0,		(origArgs.map2_image or origArgs.map2) and (mw.ustring.match((origArgs.map2_size or 300),"(%d*)")) or 0,		(origArgs.map3_image or origArgs.map3) and (mw.ustring.match((origArgs.map3_size or 300),"(%d*)")) or 0,		(origArgs.map4_image or origArgs.map4) and (mw.ustring.match((origArgs.map4_size or 300),"(%d*)")) or 0	) local pagetitle = frame:getParent and frame:getParent:getTitle or frame:getTitle args = { child = origArgs.child or origArgs.embed, bodyclass = origArgs.election_date and origArgs.vevent or nil, bodystyle = "line-height:1.5em;" .. ((width > 0) and ("width:"..width.."px;") or ""), titleclass = "summary", titlestyle = "font-size:125%;", title = ((origArgs.child or origArgs.embed) == yes) and (origArgs.election_name and ' '..origArgs.election_name..' ') or (origArgs.election_name or (frame:getParent and frame:getParent:getTitle or frame:getTitle)), datastyle = "text-align:center;", labelstyle = "width:5em;white-space:nowrap;", subheaderstyle = "line-height:130%;", subheader1 = origArgs.flag_image and (require('Module:InfoboxImage').InfoboxImage( frame:newChild{ title = frame:getTitle, args = { image = origArgs.flag_image, size = "50px", alt = "", link = "" } }			) .. " ")			or (require('Module:CountryData').gettable(mw.getCurrentFrame,origArgs.country).alias and (require('Module:flag').deco(				frame:newChild{ title = frame:getTitle, args = {					[1] = origArgs.country,					variant = origArgs.flag_year,					size = "50px"				} }			) .. " ") ),		}	return require('Module:Infobox').infoboxTemplate(		frame:newChild{ title = frame:getTitle, args = args }		) end