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:Infobox Wahl').gewahlt
function p.form(num)
return tonumber(num) and mw.getLanguage('de'):formatNum(tonumber(num)) or num == '*' and '' or '–'
end
function p.pz(frame)
local args = getArgs(frame)
a = args[1]
b = args[2]
c = args[3]
if tonumber(a) and tonumber(b) then
q = a*100/b
s = string.format('%.1f', q)
if c and tonumber(s) == tonumber(c) and tonumber(q) < tonumber(c) then
k = string.format('%.2f', q) else
k = s
end
z = string.gsub(k, "%.", "%,")
elseif a == '*' then z = ''
else z = '–'
end
return z
end
function p.wahl(frame)
local args = getArgs(frame)
if args['farbe'] or args['p'] == 's' then farben = true end
if args['typ'] == 'ST' then ST = 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
if args['kein'] == '1' then kein = 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 colsub3 = 3 + (args['DSD1'] and 1 or 0) + (args['DMD1'] and 1 or 0)
local data = {}
maxvalue = 0
gesamts = 0
gesamtm = 0
gesamtsz = 0
gesamtmz = 0
gesamtsd = 0
gesamtmd = 0
local num = 1
local stimme = (PR or PRZ) and 3 or 2
local mandat = 3
local zstimme = 4
local zmandat = PAG and 4 or 5
local dstimme = 6
local dmandat = 7
while args[tonumber(num)] do
data = {
stimmen = tonumber(args[stimme]) or 0,
mandate = tonumber(args[mandat]) or 0,
zstimmen = (PR or ST) and (tonumber(args['z'..num]) or 0) or (tonumber(args[zstimme]) or 0),
zmandate = tonumber(args[zmandat]) or 0,
dstimmen = tonumber(args[dstimme]) or 0,
dmandate = tonumber(args[dmandat]) or 0
}
num = num + 1
stimme = stimme + (ST and 2 or ((PA or PR) and 3 or (PRZ and 4 or (PAG and 5 or (PAZ and 6 or 8)))))
mandat = mandat + (PA and 3 or (PAG and 5 or (PAZ and 6 or 8)))
zstimme = zstimme + (PRZ and 4 or (PAZ and 6 or 8))
zmandat = zmandat + (PAG and 5 or (PAZ and 6 or 8))
dstimme = dstimme + 8
dmandat = dmandat + 8
maxvalue = math.max(maxvalue, data.stimmen)
gesamts = args['gesamts'] or (tonumber(gesamts) or 0) + data.stimmen
gesamtm = args['gesamtm'] or gesamtm + data.mandate
gesamtsz = args['gesamtsz'] or gesamtsz + data.zstimmen
gesamtmz = args['gesamtmz'] or gesamtmz + data.zmandate
gesamtsd = args['gesamtsd'] or AUT and (gesamts+gesamtsz) or gesamtsd + data.dstimmen
gesamtmd = args['gesamtmd'] or gesamtmd + data.dmandate
end
gesamtsg = (tonumber(gesamts) or 0) + gesamtsz
gesamtmg = args['gesamtmg'] or (gesamtm + gesamtmz + (PAD and gesamtmd or 0))
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 or ST) 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 or ST) 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
root = mw.html.create('table'):addClass('wikitable sortable'):css('text-align', 'right'):css('float', args['p1'] and 'left' or 'inherit'):css('margin-right', args['p1'] and '1em' or '0.1em')
row = root:tag('tr')
row:tag('th')
:wikitext((PR or PRZ) and 'Kandidaten' or (ST and (args['titel'] or 'Wahl') 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', colsub3)
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 ipairs(args) do
row = root:tag('tr')
local i = 0
for datum = 1, 60 do i = i + 1
if ST and tonumber(k) and (((k - 1)/2 + 1) == i) then
if farben then
row:tag('td')
:css('background', '#'..farbe({args['farbe'] or v}))
end
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[k+1]))
row:tag('td')
:wikitext(p.pz({args[k+1], gesamts}))
if args['z'..i] then
row:tag('td')
:wikitext(p.form(args['z'..i]))
row:tag('td')
:wikitext(p.pz({args['z'..i], gesamtsz}))
end
elseif PR and tonumber(k) and (((k - 1)/3 + 1) == i) then
if farben then
row:tag('td')
:css('background', '#'..farbe({args[k+1]}))
end
row:tag('td')
:wikitext(v..(((args['gew'..i] == 'j') or (args['gew'] and i <= tonumber(args['gew']))) and gewahlt({'gewählt'}) or ''))
:css('text-align', 'left')
row:tag('td')
:wikitext(args[k+1])
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[k+2]))
row:tag('td')
:wikitext(p.pz({args[k+2], gesamts}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DS'..i])
end
if args['z'..i] then
row:tag('td')
:wikitext(p.form(args['z'..i]))
row:tag('td')
:wikitext(p.pz({args['z'..i], gesamtsz}))
end
elseif PRZ and tonumber(k) and (((k - 1)/4 + 1) == i) then
if farben then
row:tag('td')
:css('background', '#'..farbe({args[k+1]}))
end
row:tag('td')
:wikitext(v..(((tonumber(args[k+2]) == maxvalue) and not kein) and gewahlt({'gewählt im WK'}) or ''))
:css('text-align', 'left')
row:tag('td')
:wikitext(args[k+1])
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[k+2]))
row:tag('td')
:wikitext(p.pz({args[k+2], gesamts}))
row:tag('td')
:wikitext(p.form(args[k+3]))
row:tag('td')
:wikitext(p.pz({args[k+3], gesamtsz}))
elseif PA and tonumber(k) and (((k - 1)/3 + 1) == i) then
if farben then
row:tag('td')
:css('background', '#'..farbe({v}))
end
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[k+1]))
row:tag('td')
:wikitext(p.pz({args[k+1], gesamts}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DS'..i])
end
row:tag('td')
:wikitext(args[k+2])
if args['DM1'] then
row:tag('td')
:wikitext(args['DM'..i])
end
elseif PAG and tonumber(k) and (((k - 1)/5 + 1) == i) then
if farben then
row:tag('td')
:css('background', '#'..farbe({v}))
end
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[k+1]))
row:tag('td')
:wikitext(p.pz({args[k+1], gesamts}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DS'..i])
end
row:tag('td')
:wikitext(args[k+2])
row:tag('td')
:wikitext(args[k+3])
row:tag('td')
:wikitext(args[k+4])
if args['DMG1'] then
row:tag('td')
:wikitext(args['DMG'..i])
end
elseif PAZ and tonumber(k) and (((k - 1)/6 + 1) == i) then
if farben then
row:tag('td')
:css('background', '#'..farbe({v}))
end
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[k+1]))
row:tag('td')
:wikitext(p.pz({args[k+1], gesamts}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DS'..i])
end
row:tag('td')
:wikitext(args[k+2])
if args['DM1'] then
row:tag('td')
:wikitext(args['DM'..i])
end
row:tag('td')
:wikitext(p.form(args[k+3]))
row:tag('td')
:wikitext(p.pz({args[k+3], gesamtsz, args['klausel']}))
if args['DSZ1'] then
row:tag('td')
:wikitext(args['DSZ'..i])
end
if not BY then
row:tag('td')
:wikitext(args[k+4])
if args['DMZ1'] then
row:tag('td')
:wikitext(args['DMZ'..i])
end
end
if AUT then
row:tag('td')
:wikitext(p.form((tonumber(args[k+1]) or 0) + (tonumber(args[k+3]) or 0)))
row:tag('td')
:wikitext(p.pz({(tonumber(args[k+1]) or 0) + (tonumber(args[k+3]) or 0), gesamtsd}))
if args['DSD1'] then
row:tag('td')
:wikitext(args['DSD'..i])
end
if BY then
row:tag('td')
:wikitext(args[k+4])
elseif HB then
row:tag('td')
:wikitext(args[k+5])
end
if args['DMD1'] then
row:tag('td')
:wikitext(args['DMD'..i])
end
end
if not HB then
row:tag('td')
:wikitext(args[k+5])
if args['DMG1'] then
row:tag('td')
:wikitext(args['DMG'..i])
end
if args['BG'] then
row:tag('td')
:wikitext(args['B'..i] or '–')
end
end
elseif PAD and tonumber(k) and (((k - 1)/8 + 1) == i) then
if farben then
row:tag('td')
:css('background', '#'..farbe({v}))
end
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(p.form(args[k+1]))
row:tag('td')
:wikitext(p.pz({args[k+1], gesamts}))
if args['DS1'] then
row:tag('td')
:wikitext(args['DS'..i])
end
row:tag('td')
:wikitext(args[k+2])
if args['DM1'] then
row:tag('td')
:wikitext(args['DM'..i])
end
row:tag('td')
:wikitext(p.form(args[k+3]))
row:tag('td')
:wikitext(p.pz({args[k+3], gesamtsz}))
if args['DSZ1'] then
row:tag('td')
:wikitext(args['DSZ'..i])
end
row:tag('td')
:wikitext(args[k+4])
if args['DMZ1'] then
row:tag('td')
:wikitext(args['DMZ'..i])
end
row:tag('td')
:wikitext(p.form(args[k+5]))
row:tag('td')
:wikitext(p.pz({args[k+5], gesamtsd}))
if args['DSD1'] then
row:tag('td')
:wikitext(args['DSD'..i])
end
row:tag('td')
:wikitext(args[k+6])
if args['DMD1'] then
row:tag('td')
:wikitext(args['DMD'..i])
end
row:tag('td')
:wikitext(args[k+7])
if args['DMG1'] then
row:tag('td')
:wikitext(args['DMG'..i])
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 args['DS1'] then
row:tag('th')
end
if parl then
row:tag('th')
:wikitext(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(gesamtmz)
:css('text-align', 'right')
row:tag('th')
:wikitext(gesamtmg)
:css('text-align', 'right')
if args['DMG1'] then
row:tag('th')
:wikitext(args['DMG'] or '–')
: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(gesamtmz)
:css('text-align', 'right')
if args['DMZ1'] then
row:tag('th')
:wikitext(args['DMZ'] or '–')
:css('text-align', 'right')
end
end
if PAD or AUT then
row:tag('th')
:wikitext(p.form(AUT and gesamtsg or gesamtsd))
:css('text-align', 'right')
row:tag('th')
:wikitext('100')
:css('text-align', 'right')
if args['DSD1'] then
row:tag('th')
end
if not HB then
row:tag('th')
:wikitext(BY and gesamtmz or gesamtmd)
:css('text-align', 'right')
if args['DMD1'] then
row:tag('th')
:wikitext(args['DMD'] or '–')
:css('text-align', 'right')
end
end
end
row:tag('th')
:wikitext(gesamtmg)
:css('text-align', 'right')
if args['DMG1'] or (HB and args['DMD1']) then
row:tag('th')
:wikitext(args['DMG'] or args['DMD'] or '–')
:css('text-align', 'right')
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 'Nicht abgegebene 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ählende')
: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ählende')
: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 kein then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:attr('colspan', zeile)
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('<span style="font-weight:bold">Anmerkung:</span> kein Kandidat hat ein Direktmandat bekommen (siehe [[Bundestagswahlrecht#Sitzverteilung_ab_2023|Wahlrechtsreform]])')
:attr('colspan', zeile)
:css('font-size', '90%')
:css('text-align', 'left')
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('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
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.