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

נוספו 255 בתים ,  לפני 10 חודשים
Vote and % columns disappear if no votes (party, valid, invalid), electorate or turnout is input
(Avoid unwanted displays of zeroes)
(Vote and % columns disappear if no votes (party, valid, invalid), electorate or turnout is input)
local stop_flag = false
local i = 0
local has_votes = args['invalid'] or args['totalvotes'] or args['electorate'] or args['turnout']
while stop_flag == false do
stop_flag = true
table.insert(index, i)
if args['votes' .. i] then
has_votes = true
if tonumber(args['votes' .. i]) then showtotal.votes = 1 end
local votesi = tonumber(args['votes' .. i]) or 0
end
if args['votes' .. i .. '_2'] then
has_votes = true
rounds = 2
if tonumber(args['votes' .. i .. '_2']) then showtotal.votes_2 = 1 end
:done()
cols = cols + 2
row
:tag('th')
:wikitext(args.candtitle or 'Candidate')
:attr('scope', 'col')
:attr('rowspan', rowspan)
:done()
cols = cols + 1
elseif headings['cand'] then
row
end
if rounds > 1 then
if has_votes then
row
:tag('th')row
:tag('th')
:wikitext(args.firstround or 'First round')
:attrwikitext('scope',args.firstround or 'colFirst round')
:attr('colspanscope', 2'col')
:doneattr('colspan', 2)
:tagdone('th')
:tag('th')
:wikitext(args.secondround or 'Second round')
:wikitext(args.firstroundsecondround or 'FirstSecond round')
:attr('scope', 'col')
:attr('colspanscope', 2'col')
:doneattr('colspan', 2)
:done()
end
secondrow = root:tag('tr')
else
end
rowspan = (rounds > 1) and 1 or (rounds < 2 and headings['st1t']) and 2 or nil
if has_votes then
for k=1, rounds do
secondrow
:tag('th')secondrow
:wikitexttag('Votesth')
:attrwikitext('scope', 'colVotes')
:attr('rowspanscope', rowspan'col')
:doneattr('rowspan', rowspan)
:tagdone('th')
:wikitexttag('%th')
:attrwikitext('scope', 'col%')
:attr('rowspanscope', rowspan'col')
:doneattr('rowspan', rowspan)
:done()
cols = cols + 2
end
end
if headings['sw'] then
- (headings['st4t'] and 1 or 0)
- (headings['st5t'] and 1 or 0)
+ (has_votes and 0 or 2)
local rsuff = (rounds > 1) and {'', '_2'} or {''}
for i, v in ipairs(index) do
elseif headings['sw'] then
row:tag('td'):attr('colspan', 3)
elseif has_votes then
else
row:tag('td'):attr('colspan', 2)
end