local p =
function getstates(frame) local states = frame:expandTemplate if states
function p.EVs(frame) local states = getstates(frame) if not states then return frame:expandTemplate else local total = 0 for state in mw.ustring.gmatch(states, "%a%a") do seats = frame:expandTemplate if state
'nil' then total = error("Unrecognized state") break else total = total + seats + 2 end end return total endend
function p.percent(frame) local EVs = p.EVs(frame) denom = 538 places = 1 if frame.args[2] then denom = frame.args[2] end if frame.args[3] then places = frame.args[3] end percent = frame:expandTemplate return percentend
function p.states(frame) local states = getstates(frame) local total = 0 for state in mw.ustring.gmatch(states, "%a%a") do if state ~= 'DC' then total = total + 1 end end if total
'spell' then total = frame:expandTemplate end return total endend
function p.overlays(frame) local states = getstates(frame) local size = frame.args['size'] or '325px' if frame.args[1]
'pending' then color = 'yellow' end local overlays = for state in mw.ustring.gmatch(states, "%a%a") do state_overlay = '
' overlays = overlays .. state_overlay end return overlaysend
function p.signatories(frame) local states = frame:expandTemplate local signatories = for state in mw.ustring.gmatch(states, "%a%a") do state_name = frame:expandTemplate local link_target = state_name if state
'GA' then link_target = 'Georgia (U.S. state)' elseif state
'WA' then link_target = 'Washington (state)' end signatories = signatories .. '\n* ' .. ' ' .. state_name .. '' end return signatoriesend
--function p.progress_bar(frame)-- local-- --end
return p