יחידה:Election results – הבדלי גרסאות

Add swing parameter
(Copy fix from sandbox)
(Add swing parameter)
for kk = 1, 20 do
i = i + 1
for k, key in ipairs({'cand', 'vp', 'party', 'sc', 'sw', 'seats'}) do
if args[key .. i] then
headings[key] = true
args['color' .. i] = 'inherit'
args['row' .. i] = 'Total'
args['sw' .. i] = '–'
args['seats' .. i] = seats
args['sc' .. i] = seatdiff
:attr('scope', 'col')
cols = cols + 2
end
if headings['sw'] then
row
:tag('th')
:wikitext('+/–')
:attr('scope', 'col')
:attr('rowspan', rowspan)
cols = cols + 1
end
if headings['seats'] then
local cs = cols - 2*rounds
- (headings['sw'] and 1 or 0)
- (headings['seats'] and 1 or 0)
- (headings['sc'] and 1 or 0)
row:tag('td'):attr('colspan', 2)
end
end
if headings['sw'] then
row
:tag('td')
:css('text-align', 'right')
:wikitext(args['sw' .. v])
end
if headings['seats'] then
:wikitext(pct(ovalid[k], ovalid[k] + invalid[k]))
end
if headings['sw'] or headings['seats'] or headings['sc'] then
local cspan = (headings['sw'] and 1 or 0) + (headings['seats'] and 1 or 0) + (headings['sc'] and 1 or 0)
row
:tag('td')
:wikitext(pct(invalid[k], ovalid[k] + invalid[k]))
end
if headings['sw'] or headings['seats'] or headings['sc'] then
local cspan = (headings['sw'] and 1 or 0) + (headings['seats'] and 1 or 0) + (headings['sc'] and 1 or 0)
row
:tag('td')
:wikitext(pct(1,1))
end
if headings['sw'] or headings['seats'] or headings['sc'] then
local cspan = (headings['sw'] and 1 or 0) + (headings['seats'] and 1 or 0) + (headings['sc'] and 1 or 0)
row
:tag('td')
:wikitext(pct(ovalid[k] + invalid[k], electorate[k]))
end
if headings['sw'] or headings['seats'] or headings['sc'] then
local cspan = (headings['sw'] and 1 or 0) + (headings['seats'] and 1 or 0) + (headings['sc'] and 1 or 0)
row
:tag('td')