Module:Election results/sandbox: Difference between revisions

Content deleted Content added
Tags: Mobile edit Mobile web edit Advanced mobile edit
+
 
(32 intermediate revisions by 3 users not shown)
Line 263:
-- build the table
local root = mw.html.create(args['embed'] and '' or 'table')
if args['embed'] == nil and args['floatright'] then
root
:addClass('wikitable sortable floatright')
:tag('caption')
:wikitext(args.caption)
:done()
elseif args['embed'] == nil then
root
:addClass('wikitable sortable')
Line 276 ⟶ 282:
:tag('th')
:css('text-align', 'center')
:css('backgroundcolor', 'var( --color-base, #F8F9FA202122 )')
:css('background', 'var( --background-color-neutral, #F8F9FA )')
:wikitext(args['image'])
end
Line 284 ⟶ 291:
:tag('td')
:css('text-align', 'center')
:css('backgroundcolor', 'var( --color-base, #F8F9FA202122 )')
:css('background', 'var( --background-color-neutral, #F8F9FA )')
end
topcell:tag('div')
Line 338 ⟶ 346:
:attr('rowspan', rowspan)
:attr('colspan', 2)
if headings['vp'] then
row
:tag('th')
:wikitext('Running mate')
:attr('scope', 'col')
:attr('rowspan', rowspan)
:done()
cols = cols + 1
end
row
:tag('th')
Line 365 ⟶ 382:
cols = cols + 1
end
if headings['vp'] and not has_alliance then
row
:tag('th')
Line 689 ⟶ 706:
:tag('td')
:attr('rowspan', args['candspan' .. v] or args['aspan' .. v])
:attr('scope', 'row')
:wikitext(args['cand' .. v])
end
Line 694 ⟶ 712:
row
:tag('td')
:attr('rowspan', args['candspan' .. v] or args['aspan' .. v])
:wikitext(args['vp' .. v])
end
Line 700 ⟶ 719:
:tag('td')
:attr('rowspan', args['aspan' .. v])
:attr('scope', 'row')
:wikitext(args['alliance' .. v])
end
Line 714 ⟶ 734:
:attr('rowspan', args['aspan' .. v])
:attr('colspan', 3)
:attr('scope', 'row')
:wikitext(args['alliance' .. v])
end
if args['alliance' .. v] and args['party' .. v] and not has_cand then
row
:tag('td')
:attr('rowspan', args['aspan' .. v])
:attr('scope', 'row')
:wikitext(args['alliance' .. v])
elseif args['alliance' .. v] and args['party' .. v] and args.dsv then
row
:tag('td')
:attr('rowspan', args['aspan' .. v])
:attr('scope', 'row')
:wikitext(args['alliance' .. v])
elseif args['alliance' .. v] and args['party' .. v] then
row
:tag('td')
Line 722 ⟶ 755:
:wikitext(args['alliance' .. v])
end
if args['party' .. v] and not has_alliance orand args['cand' .. v] and has_party and not has_alliancedsv then
row
:tag('td')
:attr('scope', 'row')
:wikitext(args['party' .. v])
elseif args['party' .. v] and not has_cand and not has_alliance then
row
:tag('td')
:attr('scope', 'row')
:wikitext(args['party' .. v])
elseif args['party' .. v] and not has_alliance or args['cand' .. v] and has_party and not has_alliance then
row
:tag('td')
Line 732 ⟶ 775:
:tag('td')
:attr('colspan', cs)
:attr('scope', 'row')
:wikitext(args['row' .. v])
end
Line 752 ⟶ 796:
:tag('td')
:attr('colspan', 2)
:attr('scope', 'row')
:wikitext('Total')
end
Line 758 ⟶ 803:
:css('font-style', 'italic')
:tag('td')
:attr('scope', 'row')
:wikitext('Total')
end
Line 765 ⟶ 811:
:tag('td')
:attr('colspan', 3)
:attr('scope', 'row')
:wikitext('Total')
end
Line 1,044 ⟶ 1,091:
row
:tag('td')
:css('backgroundcolor', 'var( --color-base, #eaecf0202122 )')
:css('background', 'var( --background-color-neutral, #eaecf0 )')
:attr('colspan', cols)
end
Line 1,060 ⟶ 1,108:
:css('text-align', 'left')
:css('font-weight', 'normal')
:css('color', 'inherit')
:css('background', 'inherit')
if args['invalid'] then
Line 1,164 ⟶ 1,213:
:css('text-align', 'left')
:css('font-weight', 'normal')
:css('color', 'inherit')
:css('background', 'inherit')
else
Line 1,174 ⟶ 1,224:
:css('text-align', 'left')
:css('font-weight', 'normal')
:css('color', 'inherit')
:css('background', 'inherit')
end
Line 1,268 ⟶ 1,319:
end
-- blank votes
if args['blank'] or args['blank2'] or args['blank3'] then
row = root:tag('tr')
:addClass('sortbottom')
Line 1,279 ⟶ 1,330:
:css('text-align', 'left')
:css('font-weight', 'normal')
:css('color', 'inherit')
:css('background', 'inherit')
if args['blank'] then
row
:tag('td')
:wikitext(fmt(blank[1]))
:tag('td')
:wikitext(pct(blank[1], ovalid[1] + invalid[1] + blank[1]))
else
row
:tag('td')
:wikitext()
:tag('td')
:wikitext()
end
if has_seats2 and not headings['sw'] then
row
Line 1,623 ⟶ 1,683:
row
:tag('td')
:css('backgroundcolor', 'var( --color-base, #eaecf0202122 )')
:css('background', 'var( --background-color-neutral, #eaecf0 )')
:attr('colspan', cols)
end
Line 1,637 ⟶ 1,698:
:css('text-align', 'left')
:css('font-weight', 'normal')
:css('color', 'inherit')
:css('background', 'inherit')
for k=1, rounds do
Line 1,695 ⟶ 1,757:
:css('text-align', 'left')
:css('font-weight', 'normal')
:css('color', 'inherit')
:css('background', 'inherit')
for k=1, rounds do