Modul:Wahl Listen
Zur Navigation springen
Zur Suche springen
Die Dokumentation für dieses Modul kann unter Modul:Wahl Listen/Doku erstellt werden
local p = {}
local getArgs = require('Module:Arguments').getArgs
local farbe = require('Module:Partei').farbe
function p.kandidaten(frame)
local args = getArgs(frame)
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 root = mw.html.create('table'):addClass('wikitable sortable')
root
:tag('th'):attr('colspan', '2'):wikitext('Listen'):done()
:tag('th'):wikitext('Kandidaten'):done()
if args['w1'] then
root
:tag('th'):wikitext('Wahlkreis'):done()
end
if args['s1'] then
root
:tag('th'):wikitext('Stimmen'):done()
end
for i, v in ipairs(index) do
row = root: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 = root:tag('tr')
:addClass('sortbottom')
row:tag('td')
:attr('colspan', 4)
if verzicht then
row = root: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 = root:tag('tr')
:addClass('sortbottom')
row:tag('td')
:attr('colspan', 4)
:wikitext('Option '..opt)
:css('font-size', '90%')
end
end
end
if args['url'] then quelle = 'Quelle: ['..args['url']..' '..args['quelle']..']' elseif args['quellen'] then quelle = 'Quellen: '..args['quellen'] end
if args['url'] or args['quellen'] then
row = root:tag('tr')
:addClass('sortbottom')
row:tag('td')
:attr('colspan', 4)
row = root:tag('tr')
:addClass('sortbottom')
row:tag('td')
:attr('colspan', 4)
:wikitext(quelle)
end
return tostring(root)
end
return p