Modul:Wahl Listen
Die Dokumentation für dieses Modul kann unter Modul:Wahl Listen/Doku erstellt werden
local p = {}
local getArgs = require('Modul:Arguments').getArgs
local farbe = require('Modul:Partei').farbe
local gewahlt = require('Modul:Direktwahl').gewahlt
function p.form(num)
return tonumber(num) and mw.getLanguage('de'):formatNum(tonumber(num)) or '–'
end
function p.pz(frame)
local args = getArgs(frame)
a = args[1]
b = args[2]
if tonumber(a) and tonumber(b) then
s = string.format('%.1f', a*100/b)
z = string.gsub(s, "%.", "%,")
else
z = '–'
end
return z
end
function p.wahl(frame)
local args = getArgs(frame)
if args['p'] == 's' then farben = true end
if args['typ'] == 'PR' then PR = true end
if args['typ'] == 'PA' then PA = true end
if args['typ'] == 'PAG' then PAG = true end
if args['typ'] == 'PRZ' then PRZ = true end
if args['typ'] == 'PAZ' then PAZ = true end
if args['typ'] == 'PAD' then
if args['system'] == 'BY' then BY = true PAZ = true AUT = true
elseif args['system'] == 'HB' then HB = true PAZ = true AUT = true
else PAD = true end
end
if args['z1'] or PRZ or PAZ or PAD then zweite = true end
local system = args['system'] or ''
local zeile = 4 + (farben and 1 or 0) + (args['DS1'] and 1 or 0) + (args['DM1'] and 1 or 0) + ((PAG or zweite) and 2 or 0) + (AUT and 4 or (PAZ and 2 or (PAD and 5 or 0))) + (args['DSZ1'] and 1 or 0) + (args['DMZ1'] and 1 or 0) + (args['DSD1'] and 1 or 0) + (args['DMD1'] and 1 or 0) + (args['DMG1'] and 1 or 0) + (args['BG'] and 1 or 0)
local coltitel = farben and 2 or 1
local rowtitel = (PAG or zweite) and 2 or 1
local colspalte = farben and ((PR or PRZ) and 3 or 2) or ((PR or PRZ) and 2 or 1)
local colsub1 = 2 + ((PAZ or PAD) and 1 or 0) + (args['DS1'] and 1 or 0) + (args['DM1'] and 1 or 0)
local colsub2 = BY and 2 + (args['DSZ1'] and 1 or 0) or PAG and 3 + (args['DMG1'] and 1 or 0) or colsub1
local gesamts = args['gesamts']
local gesamtsz = args['gesamtsz']
local gesamtsd = AUT and (gesamts+gesamtsz) or args['gesamtsd']
local gultiged = HB and (args['gültige'] + args['gültigez'])
local wahler = args['wähler']
local wahlerz = (PRZ or BY) and wahler or args['wählerz']
local wahlerd = BY and '' or (HB and (wahler+wahlerz) or args['wählerd'])
local abgegebened = BY and (args['abgegebene'] + args['abgegebenez']) or args['abgegebened'] or ''
local ungultige = wahler and (args['abgegebene'] or wahler) - (args['gültige'] or gesamts) - (args['hungültige'] or 0)
local ungultigez = wahlerz and (args['abgegebenez'] or wahlerz) - (args['gültigez'] or gesamtsz) - (args['hungültigez'] or 0) or '–'
local ungultiged = (BY or HB) and ungultige + ungultigez or wahlerd and (args['abgegebened'] or wahlerd) - (args['gültiged'] or gesamtsd) - (args['hungültiged'] or 0) or '–'
local ausgefallened = BY and '' or args['abgegebened'] and (wahlerd - abgegebened)
local wahlberechtigte = args['wahlberechtigte']
local wahlberechtigtez = PRZ and args['wahlberechtigte'] or args['wahlberechtigtez']
local wahlberechtigted = HB and (wahlberechtigte+wahlberechtigtez) or args['wahlberechtigted']
local titel1 = PR and '1. Wahlgang' or PAG and 'Stimmen' or ((system == '1') and '1. Wahlgang') or ((system == '2') and 'Direktstimmen') or (system == '3' and 'Wahlkreisstimmen') or (system == '4' and 'Provinzialstimmen') or (system == '5' and 'Listenstimmen') or (HB and 'Stadt Bremen') or 'Erststimmen'
local titel2 = PR and '2. Wahlgang' or PAG and 'Mandate' or ((system == '1') and '2. Wahlgang') or ((system == '2') and 'Listenstimmen') or (system == '3' and 'Landesstimmen') or (system == '4' and 'Nationalstimmen') or (system == '5' and 'Wahlkreisstimmen') or (HB and 'Bremerhaven') or 'Zweitstimmen'
local titel3 = BY and 'Gesamtstimmen' or HB and 'Land Bremen' or 'Regionalstimmen'
if PA or PAG or PAZ or PAD then parl = true end
if args['p1'] then
root = mw.html.create('table'):addClass('wikitable sortable'):css('text-align', 'right'):css('float', 'left'):css('margin-right', '1em')
else
root = mw.html.create('table'):addClass('wikitable sortable'):css('text-align', 'right')
end
row = root:tag('tr')
row:tag('th')
:wikitext((PR or PRZ) and 'Kandidaten' or 'Listen')
:attr('colspan', coltitel)
:attr('rowspan', rowtitel)
if PR or PRZ then
row:tag('th')
:wikitext(PRZ and 'Parteien/Listen' or 'Parteien')
:attr('rowspan', rowtitel)
end
if PAG or zweite then
row:tag('th')
:wikitext(titel1)
:attr('colspan', colsub1)
row:tag('th')
:wikitext(titel2)
:attr('colspan', colsub2)
if PAD or AUT then
row:tag('th')
:wikitext(titel3)
:attr('colspan', colsub1)
end
if (PAZ or PAD) and not HB then
if args['DMG1'] then
row:tag('th')
:wikitext('Mandate')
:attr('colspan', 2)
else
row:tag('th')
:wikitext('Mandate<br/>Gesamt')
:attr('rowspan', 2)
end
if args['BG'] then
row:tag('th')
:wikitext('[[Berliner Bundestagsabgeordneter|Berliner<br/>Abg.]]')
:attr('rowspan', 2)
end
end
row = root:tag('tr')
row:tag('th')
:wikitext(PAG and 'Anzahl' or 'Stimmen')
row:tag('th')
:wikitext('%')
if parl and args['DS1'] then
row:tag('th')
:wikitext('+/-')
end
if PAZ or PAD then
row:tag('th')
:wikitext('Mandate')
if args['DM1'] then
row:tag('th')
:wikitext('+/-')
end
end
if PAG then
row:tag('th')
:wikitext('Direkt-<br/>Mandate')
row:tag('th')
:wikitext('Listen-<br/>Mandate')
row:tag('th')
:wikitext('Gesamt<br/>Mandate')
if args['DMG1'] then
row:tag('th')
:wikitext('+/-')
end
else
row:tag('th')
:wikitext('Stimmen')
row:tag('th')
:wikitext('%')
end
if PAZ or PAD then
if args['DSZ1'] then
row:tag('th')
:wikitext('+/-')
end
if not BY then
row:tag('th')
:wikitext('Mandate')
if args['DMZ1'] then
row:tag('th')
:wikitext('+/-')
end
end
if PAD or AUT then
row:tag('th')
:wikitext('Stimmen')
row:tag('th')
:wikitext('%')
if args['DSD1'] then
row:tag('th')
:wikitext('+/-')
end
row:tag('th')
:wikitext('Mandate')
if args['DMD1'] then
row:tag('th')
:wikitext('+/-')
end
end
if args['DMG1'] then
row:tag('th')
:wikitext('Anzahl')
row:tag('th')
:wikitext('+/-')
end
end
else
row:tag('th')
:wikitext('Stimmen')
row:tag('th')
:wikitext('%')
if args['DS1'] then
row:tag('th')
:wikitext('+/-')
end
if PA then
row:tag('th')
:wikitext('Mandate')
if args['DM1'] then
row:tag('th')
:wikitext('+/-')
end
end
end
for k,v in pairs(args) do
if PR then
if tonumber(k) and ((tonumber(k) - 3 * math.floor(tonumber(k)/3)) == 1) then
row = root:tag('tr')
if farben then
row:tag('td')
:css('background', '#'..farbe({args[tonumber(k+1)]}))
:css('width', '0px')
end
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(args[tonumber(k+1)])
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[tonumber(k+2)]))
row:tag('td')
:wikitext(p.pz({args[tonumber(k+2)], gesamts}))
if args['z'..((tonumber(k+2)/3))] then
row:tag('td')
:wikitext(p.form(args['z'..((tonumber(k+2)/3))]))
row:tag('td')
:wikitext(p.pz({args['z'..(tonumber(k+2)/3)], gesamtsz}))
end
end
elseif PRZ then
if tonumber(k) == 1 then gew = gewahlt({'gewählt im WK'}) else gew = '' end
if tonumber(k) and ((tonumber(k) - 4 * math.floor(tonumber(k)/4)) == 1) then
row = root:tag('tr')
if farben then
row:tag('td')
:css('background', '#'..farbe({args[tonumber(k+1)]}))
:css('width', '0px')
end
row:tag('td')
:wikitext(v..gew)
:css('text-align', 'left')
row:tag('td')
:wikitext(args[tonumber(k+1)])
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[tonumber(k+2)]))
row:tag('td')
:wikitext(p.pz({args[tonumber(k+2)], gesamts}))
row:tag('td')
:wikitext(p.form(args[tonumber(k+3)]))
row:tag('td')
:wikitext(p.pz({args[tonumber(k+3)], gesamtsz}))
end
elseif PA then
if tonumber(k) and ((tonumber(k) - 3 * math.floor(tonumber(k)/3)) == 1) then
row = root:tag('tr')
if farben then
row:tag('td')
:css('background', '#'..farbe({v}))
:css('width', '0px')
end
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[tonumber(k+1)]))
row:tag('td')
:wikitext(p.pz({args[tonumber(k+1)], gesamts}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DS'..((tonumber(k+2)/3))])
end
row:tag('td')
:wikitext(args[tonumber(k+2)])
if args['DM1'] then
row:tag('td')
:wikitext(args['DM'..((tonumber(k+2)/3))])
end
end
elseif PAG then
if tonumber(k) and ((tonumber(k) - 5 * math.floor(tonumber(k)/5)) == 1) then
row = root:tag('tr')
if farben then
row:tag('td')
:css('background', '#'..farbe({v}))
:css('width', '0px')
end
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[tonumber(k+1)]))
row:tag('td')
:wikitext(p.pz({args[tonumber(k+1)], gesamts}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DS'..((tonumber(k+4)/5))])
end
row:tag('td')
:wikitext(args[tonumber(k+2)])
row:tag('td')
:wikitext(args[tonumber(k+3)])
row:tag('td')
:wikitext(args[tonumber(k+4)])
if args['DMG1'] then
row:tag('td')
:wikitext(args['DMG'..((tonumber(k+4)/5))])
end
end
elseif PAZ then
if tonumber(k) and ((tonumber(k) - 6 * math.floor(tonumber(k)/6)) == 1) then
row = root:tag('tr')
if farben then
row:tag('td')
:css('background', '#'..farbe({v}))
:css('width', '0px')
end
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[tonumber(k+1)]))
row:tag('td')
:wikitext(p.pz({args[tonumber(k+1)], gesamts}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DS'..((tonumber(k+5)/6))])
end
row:tag('td')
:wikitext(args[tonumber(k+2)])
if args['DM1'] then
row:tag('td')
:wikitext(args['DM'..((tonumber(k+5)/6))])
end
row:tag('td')
:wikitext(p.form(args[tonumber(k+3)]))
row:tag('td')
:wikitext(p.pz({args[tonumber(k+3)], gesamtsz}))
if args['DSZ1'] then
row:tag('td')
:wikitext(args['DSZ'..((tonumber(k+5)/6))])
end
if not BY then
row:tag('td')
:wikitext(args[tonumber(k+4)])
if args['DMZ1'] then
row:tag('td')
:wikitext(args['DMZ'..((tonumber(k+5)/6))])
end
end
if AUT then
row:tag('td')
:wikitext(p.form(args[tonumber(k+1)] + args[tonumber(k+3)]))
row:tag('td')
:wikitext(p.pz({args[tonumber(k+1)] + args[tonumber(k+3)], gesamtsd}))
if args['DSD1'] then
row:tag('td')
:wikitext(args['DSD'..((tonumber(k+5)/6))])
end
if BY then
row:tag('td')
:wikitext(args[tonumber(k+4)])
elseif HB then
row:tag('td')
:wikitext(args[tonumber(k+5)])
end
if args['DMD1'] then
row:tag('td')
:wikitext(args['DMD'..((tonumber(k+5)/6))])
end
end
if not HB then
row:tag('td')
:wikitext(args[tonumber(k+5)])
if args['DMG1'] then
row:tag('td')
:wikitext(args['DMG'..((tonumber(k+5)/6))])
end
if args['BG'] then
row:tag('td')
:wikitext(args['B'..((tonumber(k+5)/6))] or '–')
end
end
end
elseif PAD then
if tonumber(k) and ((tonumber(k) - 8 * math.floor(tonumber(k)/8)) == 1) then
row = root:tag('tr')
if farben then
row:tag('td')
:css('background', '#'..farbe({v}))
:css('width', '0px')
end
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[tonumber(k+1)]))
row:tag('td')
:wikitext(p.pz({args[tonumber(k+1)], gesamts}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DS'..((tonumber(k+7)/8))])
end
row:tag('td')
:wikitext(args[tonumber(k+2)])
if args['DM1'] then
row:tag('td')
:wikitext(args['DM'..((tonumber(k+7)/8))])
end
row:tag('td')
:wikitext(p.form(args[tonumber(k+3)]))
row:tag('td')
:wikitext(p.pz({args[tonumber(k+3)], gesamtsz}))
if args['DSZ1'] then
row:tag('td')
:wikitext(args['DSZ'..((tonumber(k+7)/8))])
end
row:tag('td')
:wikitext(args[tonumber(k+4)])
if args['DMZ1'] then
row:tag('td')
:wikitext(args['DMZ'..((tonumber(k+7)/8))])
end
row:tag('td')
:wikitext(p.form(args[tonumber(k+5)]))
row:tag('td')
:wikitext(p.pz({args[tonumber(k+5)], gesamtsz}))
if args['DSD1'] then
row:tag('td')
:wikitext(args['DSD'..((tonumber(k+7)/8))])
end
row:tag('td')
:wikitext(args[tonumber(k+6)])
if args['DMD1'] then
row:tag('td')
:wikitext(args['DMD'..((tonumber(k+7)/8))])
end
row:tag('td')
:wikitext(args[tonumber(k+7)])
if args['DMG1'] then
row:tag('td')
:wikitext(args['DMG'..((tonumber(k+7)/8))])
end
end
end
end
if args['jgültige'] then
row = root:tag('tr')
row:tag('td')
:wikitext(args['jname'] or (parl and 'Keine Liste') or 'Kein Kandidat')
:attr('colspan', colspalte)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args['jgültige']))
row:tag('td')
:wikitext(p.pz({args['jgültige'], gesamts}))
if parl then
if args['DS1'] then
row:tag('td')
:wikitext(args['DJ'])
end
row:tag('td')
:wikitext('–')
if args['DM1'] then
row:tag('td')
:wikitext('–')
end
end
if zweite then
row:tag('td')
:wikitext(p.form(args['jgültigez']))
row:tag('td')
:wikitext(p.pz({args['jgültigez'], gesamtsz}))
if parl then
if args['DSZ1'] then
row:tag('td')
:wikitext(args['DJZ'])
end
row:tag('td')
:wikitext('–')
if args['DMZ1'] then
row:tag('td')
:wikitext('–')
end
row:tag('td')
:wikitext('–')
if args['DMG1'] then
row:tag('td')
:wikitext('–')
end
end
end
end
if args['rungültige'] then
row = root:tag('tr')
row:tag('td')
:wikitext('Ungültige Stimmen')
:attr('colspan', colspalte)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args['rungültige']))
row:tag('td')
:wikitext(p.pz({args['rungültige'], gesamts}))
if parl then
if args['DS1'] then
row:tag('td')
:wikitext(args['DR'])
end
row:tag('td')
:wikitext('–')
if args['DM1'] then
row:tag('td')
:wikitext('–')
end
end
if zweite then
row:tag('td')
:wikitext(p.form(args['rungültigez']))
row:tag('td')
:wikitext(p.pz({args['rungültigez'], gesamtsz}))
if parl then
if args['DSZ1'] then
row:tag('td')
:wikitext(args['DRZ'])
end
row:tag('td')
:wikitext('–')
if args['DMZ1'] then
row:tag('td')
:wikitext('–')
end
row:tag('td')
:wikitext('–')
if args['DMG1'] then
row:tag('td')
:wikitext('–')
end
end
end
end
row = root:tag('tr'):addClass('sortbottom')
row:tag('th')
:wikitext('Gesamt')
:attr('colspan', colspalte)
:css('text-align', 'left')
row:tag('th')
:wikitext(p.form(gesamts))
:css('text-align', 'right')
row:tag('th')
:wikitext('100')
:css('text-align', 'right')
if parl then
if args['DS1'] then
row:tag('th')
end
row:tag('th')
:wikitext(args['gesamtm'])
:css('text-align', 'right')
if args['DM1'] then
row:tag('th')
:wikitext(args['DM'] or '–')
:css('text-align', 'right')
end
if PAG then
row:tag('th')
:wikitext(args['gesamtmz'])
:css('text-align', 'right')
row:tag('th')
:wikitext(args['gesamtmg'])
:css('text-align', 'right')
if args['DMG1'] then
row:tag('th')
:wikitext(args['DMG'])
:css('text-align', 'right')
end
end
end
if zweite then
row:tag('th')
:wikitext(p.form(gesamtsz))
:css('text-align', 'right')
row:tag('th')
:wikitext('100')
:css('text-align', 'right')
if parl then
if args['DSZ1'] then
row:tag('th')
end
if not BY then
row:tag('th')
:wikitext(args['gesamtmz'])
:css('text-align', 'right')
end
if args['DMZ1'] then
row:tag('th')
:wikitext(args['DMZ'] or '–')
:css('text-align', 'right')
end
if PAD or AUT then
row:tag('th')
:wikitext(p.form(gesamtsd))
:css('text-align', 'right')
row:tag('th')
:wikitext('100')
:css('text-align', 'right')
if args['DSD1'] then
row:tag('th')
end
row:tag('th')
:wikitext(args['gesamtmd'])
:css('text-align', 'right')
if args['DMD1'] then
row:tag('th')
:wikitext(args['DMD'] or '–')
:css('text-align', 'right')
end
end
if not HB then
row:tag('th')
:wikitext(args['gesamtmg'])
:css('text-align', 'right')
if args['DMG1'] then
row:tag('th')
:wikitext(args['DMG'] or '–')
:css('text-align', 'right')
end
end
if args['BG'] then
row:tag('th')
:wikitext(args['BG'])
:css('text-align', 'right')
end
end
end
if wahler or args['gültige'] or args['rungültige'] or wahlberechtigte then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:attr('colspan', zeile)
end
if args['gültige'] or args['rungültige'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(args['gültige'] and 'Gültige Stimmzettel' or 'Gültige Stimmen')
:attr('colspan', colspalte)
:css('text-align', 'left')
:css('font-weight', 'bold')
row:tag('td')
:wikitext(p.form(args['gültige'] or (gesamts - args['rungültige'])))
:css('font-weight', 'bold')
row:tag('td')
:wikitext('–')
:css('font-weight', 'bold')
if args['DS1'] then
row:tag('td')
:wikitext('–')
:css('font-weight', 'bold')
end
if zweite then
if parl then
row:tag('td')
end
if args['DM1'] then
row:tag('td')
end
row:tag('td')
:wikitext(p.form(args['gültigez'] or (gesamtsz - args['rungültigez'])))
:css('font-weight', 'bold')
row:tag('td')
:wikitext('–')
:css('font-weight', 'bold')
if args['DSZ1'] then
row:tag('td')
:wikitext('–')
:css('font-weight', 'bold')
end
if PAD or AUT then
row:tag('td')
if args['DMZ1'] then
row:tag('td')
end
row:tag('td')
:wikitext(p.form(gultiged or args['gültiged'] or (gesamtsd - args['rungültiged'])))
:css('font-weight', 'bold')
row:tag('td')
:wikitext('–')
:css('font-weight', 'bold')
if args['DSD1'] then
row:tag('td')
:wikitext('–')
:css('font-weight', 'bold')
end
end
end
end
if wahler or args['rungültige'] then
if args['hungültige'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(args['hname'] or (parl and 'Keine Liste') or 'Kein Kandidat')
:attr('colspan', colspalte)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args['hungültige']))
row:tag('td')
:wikitext(p.pz({args['hungültige'], wahler}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DH'])
end
end
if args['leere'] and args['ungültige'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('Leere Stimmzettel')
:attr('colspan', colspalte)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args['leere']))
row:tag('td')
:wikitext(p.pz({args['leere'], (args['rungültige'] and gesamts or wahler)}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DL'])
end
if zweite then
if parl then
row:tag('td')
end
if args['DM1'] then
row:tag('td')
end
row:tag('td')
:wikitext(p.form(args['leerez']))
row:tag('td')
:wikitext(p.pz({args['leerez'], wahlerz}))
if args['DSZ1'] then
row:tag('td')
:wikitext(args['DLZ'])
end
end
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('Ungültige Stimmzettel')
:attr('colspan', colspalte)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args['ungültige']))
row:tag('td')
:wikitext(p.pz({args['ungültige'], (args['rungültige'] and gesamts or wahler)}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DU'])
end
if zweite then
if parl then
row:tag('td')
end
if args['DM1'] then
row:tag('td')
end
row:tag('td')
:wikitext(p.form(args['ungültigez']))
row:tag('td')
:wikitext(p.pz({args['ungültigez'], (args['rungültigez'] and gesamtsz or wahlerz)}))
if args['DSZ1'] then
row:tag('td')
:wikitext(args['DUZ'])
end
end
elseif not args['rungültige'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(args['gültige'] and 'Ungültige Stimmzettel' or 'Ungültige Stimmen')
:attr('colspan', colspalte)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(ungultige))
row:tag('td')
:wikitext(p.pz({ungultige, wahler}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DU'])
end
if zweite then
if parl then
row:tag('td')
end
if args['DM1'] then
row:tag('td')
end
row:tag('td')
:wikitext(p.form(ungultigez))
row:tag('td')
:wikitext(p.pz({ungultigez, wahlerz}))
if args['DSZ1'] then
row:tag('td')
:wikitext(args['DUZ'])
end
if PAD or AUT then
if not BY then
row:tag('td')
if args['DMZ1'] then
row:tag('td')
end
end
row:tag('td')
:wikitext(p.form(ungultiged))
row:tag('td')
:wikitext(p.pz({ungultiged, wahlerd}))
if args['DSD1'] then
row:tag('td')
:wikitext(args['DUD'])
end
end
end
end
if args['abgegebene'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(args['gültige'] and 'Abgegebene Stimmzettel' or 'Abgegebene Stimmen')
:attr('colspan', colspalte)
:css('text-align', 'left')
:css('font-weight', 'bold')
row:tag('td')
:wikitext(p.form(args['abgegebene']))
:css('font-weight', 'bold')
row:tag('td')
:wikitext('–')
:css('font-weight', 'bold')
if args['DS1'] then
row:tag('td')
:wikitext('–')
:css('font-weight', 'bold')
end
if zweite then
if parl then
row:tag('td')
end
if args['DM1'] then
row:tag('td')
end
row:tag('td')
:wikitext(p.form(args['abgegebenez']))
:css('font-weight', 'bold')
row:tag('td')
:wikitext('–')
:css('font-weight', 'bold')
if args['DSZ1'] then
row:tag('td')
:wikitext('–')
:css('font-weight', 'bold')
end
if PAD or AUT then
if not BY then
row:tag('td')
if args['DMZ1'] then
row:tag('td')
end
end
row:tag('td')
:wikitext(p.form(abgegebened))
:css('font-weight', 'bold')
row:tag('td')
:wikitext('–')
:css('font-weight', 'bold')
if args['DSD1'] then
row:tag('td')
:wikitext('–')
:css('font-weight', 'bold')
end
end
end
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(args['gültige'] and 'Ausgefallene Stimmzettel' or 'Ausgefallene Stimmen')
:attr('colspan', colspalte)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(wahler - args['abgegebene']))
row:tag('td')
:wikitext(p.pz({(wahler - args['abgegebene']), wahler}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DA'])
end
if zweite then
if parl then
row:tag('td')
if args['DM1'] then
row:tag('td')
end
end
row:tag('td')
:wikitext(p.form(wahlerz - args['abgegebenez']))
row:tag('td')
:wikitext(p.pz({(wahlerz - args['abgegebenez']), wahlerz}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DAZ'])
end
if PAD or AUT then
if not BY then
row:tag('td')
if args['DMZ1'] then
row:tag('td')
end
end
row:tag('td')
:wikitext(p.form(ausgefallened))
row:tag('td')
:wikitext(p.pz({ausgefallened, wahlerd}))
if args['DSD1'] then
row:tag('td')
end
end
end
end
end
if args['rungültige'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('th')
:wikitext('Wähler')
:attr('colspan', colspalte)
:css('text-align', 'left')
:css('font-weight', 'bold')
row:tag('th')
:wikitext(p.form(gesamts))
:css('text-align', 'right')
:css('font-weight', 'bold')
row:tag('th')
:wikitext(p.pz({gesamts, wahlberechtigte}))
:css('text-align', 'right')
if args['DS1'] then
row:tag('th')
:wikitext(args['DW'])
:css('text-align', 'right')
end
if zweite then
if parl then
row:tag('th')
end
if args['DM1'] then
row:tag('th')
end
row:tag('th')
:wikitext(p.form(gesamtsz))
:css('text-align', 'right')
:css('font-weight', 'bold')
row:tag('th')
:wikitext(p.pz({gesamtsz, wahlberechtigtez}))
:css('text-align', 'right')
if args['DSZ1'] then
row:tag('th')
:wikitext(args['DWZ'])
:css('text-align', 'right')
end
end
elseif wahler then
row = root:tag('tr'):addClass('sortbottom')
row:tag('th')
:wikitext('Wähler')
:attr('colspan', colspalte)
:css('text-align', 'left')
row:tag('th')
:wikitext(p.form(wahler))
:css('text-align', 'right')
row:tag('th')
:wikitext(p.pz({wahler, wahlberechtigte}))
:css('text-align', 'right')
if args['DS1'] then
row:tag('th')
:wikitext(args['DW'])
:css('text-align', 'right')
end
if zweite then
if parl then
row:tag('th')
end
if args['DM1'] then
row:tag('th')
end
row:tag('th')
:wikitext(p.form(wahlerz))
:css('text-align', 'right')
row:tag('th')
:wikitext(p.pz({wahlerz, wahlberechtigtez}))
:css('text-align', 'right')
if args['DSZ1'] then
row:tag('th')
:wikitext(args['DWZ'])
:css('text-align', 'right')
end
if PAD or AUT then
if not BY then
row:tag('th')
if args['DMZ1'] then
row:tag('th')
end
end
row:tag('th')
:wikitext(p.form(wahlerd))
:css('text-align', 'right')
row:tag('th')
:wikitext(p.pz({wahlerd, wahlberechtigted}))
:css('text-align', 'right')
if args['DSD1'] then
row:tag('th')
:wikitext(args['DWD'])
:css('text-align', 'right')
end
end
end
end
if wahlberechtigte then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('Wahlberechtigte')
:attr('colspan', colspalte)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(wahlberechtigte))
row:tag('td')
if args['DS1'] then
row:tag('td')
end
if zweite then
if parl then
row:tag('td')
end
if args['DM1'] then
row:tag('td')
end
row:tag('td')
:wikitext(p.form(wahlberechtigtez))
row:tag('td')
if args['DSZ1'] then
row:tag('td')
end
if PAD or AUT then
if not BY then
row:tag('td')
if args['DMZ1'] then
row:tag('td')
end
end
row:tag('td')
:wikitext(p.form(wahlberechtigted))
row:tag('td')
if args['DSD1'] then
row:tag('td')
end
end
end
end
if args['url'] or args['quelle'] or args['quellen'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:attr('colspan', zeile)
end
if args['url'] or args['quelle'] or args['quellen'] then
quelle = ((args['url'] or args['quelle']) and 'Quelle' or 'Quellen')..': '..(args['url'] and '['..args['url']..' '..(args['quelle'] or 'Innenministerium')..']' or args['quelle'] or args['quellen'])
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(quelle)
:attr('colspan', zeile)
:css('text-align', 'left')
end
local index = {}
local i = 0
for datum = 1, 50 do i = i + 1
if args['k'..i] then table.insert(index, i) end
if args['v'..i] == 'ja' then verzicht = true end
if args['op'..i] then option = true end
end
local rootz = mw.html.create('table'):addClass('wikitable sortable')
if args['p1'] then
rootz
:tag('th'):attr('colspan', '2'):wikitext('Listen'):done()
:tag('th'):wikitext('Kandidaten'):done()
if args['w1'] then
rootz
:tag('th'):wikitext('Wahlkreis'):done()
end
if args['s1'] then
rootz
:tag('th'):wikitext('Stimmen'):done()
end
for i, v in ipairs(index) do
row = rootz:tag('tr')
if args['v'..v] then
if args['v'..v] == 'ja' then x = '⭯ ' else x = '<sup>'..args['v'..v]..' </sup>' end
else x = ''
end
if args['b'..v] then kand = x..' '..args['b'..v]..' '..args['k'..v] else
if args['link'..v] then kand = x..'[['..args['link'..v]..'|'..args['a'..v]..' '..args['k'..v]..']]'
else kand = x..'[['..args['a'..v]..' '..args['k'..v]..']]'
end
end
if args['p'..v] then
row:tag('td')
:attr('rowspan', args['n'..v])
:css('width', '0px')
:css('background', '#'..(args['f'..v] or farbe({(args['pf'..v] or args['p'..v])})))
row:tag('td')
:attr('rowspan', args['n'..v])
:wikitext(args['p'..v])
end
row:tag('td')
:wikitext('<span data-sort-value="'..args['k'..v]..'">'..kand..'</span>')
if args['w'..v] then
row:tag('td')
:wikitext(args['w'..v])
:css('text-align', 'center')
end
if args['s'..v] then
row:tag('td')
:wikitext(tonumber(args['s'..v]) and mw.getLanguage('de'):formatNum(tonumber(args['s'..v])) or '–')
:css('text-align', 'center')
end
end
if verzicht or option then
row = rootz:tag('tr'):addClass('sortbottom')
row:tag('td')
:attr('colspan', 4)
if verzicht then
row = rootz:tag('tr'):addClass('sortbottom')
row:tag('td')
:attr('colspan', 4)
:wikitext('⭯ : Verzicht auf den Sitz')
:css('font-size', '90%')
end
for i, v in ipairs(index) do
if args['op'..v] and args['opw'..v] then opt = '<span style=font-style:italic>'..args['op'..v]..'</span>: '..args['opw'..v] end
if args['op'..v] then
row = rootz:tag('tr'):addClass('sortbottom')
row:tag('td')
:attr('colspan', 4)
:wikitext('Option '..opt)
:css('font-size', '90%')
end
end
if args['kurl'] then kquelle = 'Quelle: ['..args['kurl']..' '..args['kquelle']..']' elseif args['kquellen'] then kquelle = 'Quellen: '..args['kquellen'] end
if args['kurl'] or args['kquellen'] then
row = rootz:tag('tr'):addClass('sortbottom')
row:tag('td')
:attr('colspan', 4)
row = rootz:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(kquelle)
:attr('colspan', 4)
end
end
end
if args[1] and args['p1'] then return tostring(root)..tostring(rootz)..'<div style="clear:both"></div>' elseif args[1] then return tostring(root) else return tostring(rootz) end
end
return p