Content deleted Content added
Seems to have been accidentally removed |
+ |
||
(40 intermediate revisions by 4 users not shown) | |||
Line 86:
local has_party = args['party' .. i]
local has_rspan = args['vspan' .. i] or args['v2span' .. i]
local has_sspan = args['sspan' .. i] or args['tsspan' .. i]
while stop_flag == false do
stop_flag = true
Line 147:
has_rspan = true
end
if args['sspan' .. i] or args['tsspan' .. i] then
has_sspan = true
end
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')
:done()
elseif args['embed'] == nil then
root
:addClass('wikitable sortable')
Line 276 ⟶ 282:
:tag('th')
:css('text-align', 'center')
:css('
:css('background', 'var( --background-color-neutral, #F8F9FA )')
:wikitext(args['image'])
end
Line 284 ⟶ 291:
:tag('td')
:css('text-align', 'center')
:css('
: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')
: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 493 ⟶ 510:
:done()
:tag('th')
:
▲ :wikitext('+/−')
:attr('scope', 'col')
:attr('rowspan', rowspan)
Line 546 ⟶ 562:
row
:tag('th')
:
▲ :wikitext('+/−')
:attr('scope', 'col')
:attr('rowspan', rowspan)
Line 623 ⟶ 638:
row
:tag('th')
▲ :wikitext(args.sctitle or '+/−')
:attr('scope', 'col')
:attr('rowspan', rowspan)
Line 691 ⟶ 705:
:css('background-color', rcolor)
:tag('td')
:attr('rowspan', args['candspan' .. v] or args['aspan' .. v])
:attr('scope', 'row')
:wikitext(args['cand' .. v])
end
Line 698 ⟶ 712:
row
:tag('td')
:attr('rowspan', args['candspan' .. v] or args['aspan' .. v])
:wikitext(args['vp' .. v])
end
Line 704 ⟶ 719:
:tag('td')
:attr('rowspan', args['aspan' .. v])
:attr('scope', 'row')
:wikitext(args['alliance' .. v])
end
Line 718 ⟶ 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 726 ⟶ 755:
:wikitext(args['alliance' .. v])
end
if args['party' .. v] and not has_alliance
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')
:wikitext(args['party' .. v])
end
Line 737 ⟶ 775:
:tag('td')
:attr('colspan', cs)
:attr('scope', 'row')
:wikitext(args['row' .. v])
end
Line 757 ⟶ 796:
:tag('td')
:attr('colspan', 2)
:attr('scope', 'row')
:wikitext('Total')
end
Line 763 ⟶ 803:
:css('font-style', 'italic')
:tag('td')
:attr('scope', 'row')
:wikitext('Total')
end
Line 770 ⟶ 811:
:tag('td')
:attr('colspan', 3)
:attr('scope', 'row')
:wikitext('Total')
end
Line 898 ⟶ 940:
:wikitext()
end
if headings['seats'] and args['dsv'] and not has_sspan or headings['seats'] and rounds > 1 and not has_seats2 and not has_sspan or args['seats' .. v] and has_sspan and rounds > 1 and not has_seats2 then
row
:tag('td')
Line 1,010 ⟶ 1,052:
:wikitext(args['st5t' .. v] or '–')
end
if
row
:tag('td')
:attr('rowspan', args['tsspan' .. v])
:css('text-align', 'right')
:wikitext(args['totseats' .. v] or args['atotseats' .. v] or '–')
end
if headings['totseats'] and not args['itotseats' .. v] and not args['atotseats' .. v] and not has_sspan then
row
:tag('td')
:css('text-align', 'right')
:wikitext(fmt(args['totseats' .. v]) or '–')
elseif headings['totseats'] and not has_sspan then
row
:tag('td')
Line 1,042 ⟶ 1,091:
row
:tag('td')
:css('
:css('background', 'var( --background-color-neutral, #eaecf0 )')
:attr('colspan', cols)
end
Line 1,058 ⟶ 1,108:
:css('text-align', 'left')
:css('font-weight', 'normal')
:css('color', 'inherit')
:css('background', 'inherit')
if args['invalid'] then
Line 1,162 ⟶ 1,213:
:css('text-align', 'left')
:css('font-weight', 'normal')
:css('color', 'inherit')
:css('background', 'inherit')
else
Line 1,172 ⟶ 1,224:
:css('text-align', 'left')
:css('font-weight', 'normal')
:css('color', 'inherit')
:css('background', 'inherit')
end
Line 1,266 ⟶ 1,319:
end
-- blank votes
if args['blank'] or args['blank2'] or args['blank3'] then
row = root:tag('tr')
:addClass('sortbottom')
Line 1,277 ⟶ 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')
else
row
:tag('td')
:wikitext()
:tag('td')
:wikitext()
end
if has_seats2 and not headings['sw'] then
row
Line 1,374 ⟶ 1,436:
:css('text-align', 'left')
:css('background', 'inherit')
:css('color', 'inherit')
if not args['totalvotes'] and args['invalid'] then
row
Line 1,495 ⟶ 1,558:
:css('text-align', 'left')
:css('font-weight', 'normal')
:css('color', 'inherit')
:css('background', 'inherit')
row
Line 1,619 ⟶ 1,683:
row
:tag('td')
:css('
:css('background', 'var( --background-color-neutral, #eaecf0 )')
:attr('colspan', cols)
end
Line 1,633 ⟶ 1,698:
:css('text-align', 'left')
:css('font-weight', 'normal')
:css('color', 'inherit')
:css('background', 'inherit')
for k=1, rounds do
Line 1,691 ⟶ 1,757:
:css('text-align', 'left')
:css('font-weight', 'normal')
:css('color', 'inherit')
:css('background', 'inherit')
for k=1, rounds do
|