Module:Election results/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 12:
local row, secondrow
local tracking = ''
local max_rows = 20
-- helper functions
Line 34 ⟶ 35:
 
-- preprocess the input
for i = 1, 20max_rows do
for k, key in ipairs({'cand', 'vp', 'party', 'sc', 'seats'}) do
if args[key .. i] then
Line 70 ⟶ 71:
end
end
end
-- optional against all
if args['against_all'] or args['against_all2'] then
local i = max_rows + 1
args['votes' .. i] = tonumber(args['against_all']) or 0
args['votes' .. i .. '_2'] = tonumber(args['against_all']) or 0
args['colour' .. i] = 'inherit'
args['color' .. i] = 'inherit'
args['cand' .. i] = '<AGAINST ALL>'
args['vp' .. i] = '<AGAINST ALL>'
args['party' .. i] = '<AGAINST ALL>'
end
 
Line 167 ⟶ 180:
end
end
-- create the empty color cell
row
:tag('td')
:css('background-color', color)
 
if (args['cand' .. i] or '') == '<AGAINST ALL>' then
-- add the rest of the row
if headings['cand'] then
row
:tag('td')
:wikitext(args['candAgainst all' .. v])
:attr('colspan', cols - 2*rounds)
if headings['vp'] then
else
-- create the empty color cell
row
:tag('td')
:css('background-color', color)
 
-- add the rest of the row
if headings['cand'] then
row
:tag('td')
:wikitext(args['vpcand' .. v])
if headings['vp'] then
row
:tag('td')
:wikitext(args['partyvp' .. v])
end
end
if headings['party'] then
row
:tag('td')
:wikitext(args['party' .. v])
end
end
if headings['party'] then
row
:tag('td')
:wikitext(args['party' .. v])
end
for kk, suf in ipairs(rsuff) do
Line 213 ⟶ 234:
end
end
 
row = root
:tag('tr')