Modulo:Risultati

Questo è un modulo scritto in Lua. Le istruzioni che seguono sono contenute nella sottopagina Modulo:Risultati/man (modifica · cronologia)
Sandbox: Modulo:Risultati/sandbox (modifica · cronologia) · Sottopagine: lista · Test: Modulo:Risultati/test (modifica · cronologia · Esegui)
Modulo che fornisce tabelle sui risultati elettorali e su elenchi di candidati eletti.
Funzioni
tabella
Parametri
Con i
si intende un valore intero compreso fra 1 e 60.
- carica: nome della carica monocratica
- c..i oppure cand..i: nominativo del candidato
- r..i: lista regionale cui la lista [circoscrizionale] è collegata
- a..i: alleanza cui la lista appartiene (area politica del candidato)
- n..i: numero di liste collegate
- b..i: voti ottenuti al ballottaggio dal solo candidato
- d..i: voti diretti ottenuti dal solo candidato
- l..i oppure part..i: liste
- g..i: gruppi di partiti
- p..i: partiti coalizzati in gruppi
- v..i oppure voti..i: voti ottenuti da candidati/liste
- s..i oppure seggi..i: seggi ottenuti da candidati/liste
- sa..i: seggio ottenuto dall'alleanza (seggio in prededuzione al candidato collegato)
- sc..i: seggio ottenuto dal candidato classificatosi secondo
- listino..i: seggi ottenuti dal listino
- aball1, aball2: voti ottenuti da candidati/liste nel turno annullato di ballottaggio
- ball1, ball2: voti ottenuti da candidati/liste nel ballottaggio
- vbis..i: voti ottenuti da liste nel secondo turno o nel secondo voto, es. maggioritario [ex vm..i]
- sbis..i: seggi ottenuti nel secondo turno o nel secondo voto, es. maggioritario [ex sm..i]
- vter..i: voti ottenuti da liste nel terzo turno o nel terzo voto, es. maggioritario
- ster..i: seggi ottenuti nel terzo turno o nel terzo voto, es. maggioritario
- st..i: seggi totali per lista (proporzionale + maggioritario, o primo turno + secondo turno), solo se nella tabella figurano gruppi di liste (altrimenti il calcolo è automatico)
- DV..i: differenza voti liste (raffronto con elezione precedente) [ex percv..i]
- DS..i: differenza seggi liste (raffronto con elezione precedente) [ex seggiv..i]
- DVX..i: differenza voti liste, nel secondo turno o nel secondo voto es. maggioritario (raffronto con elezione precedente)
- DSX..i: differenza seggi liste, nel secondo turno o nel secondo voto es. maggioritario (raffronto con elezione precedente)
- DVY..i: differenza voti liste, nel terzo turno o nel terzo voto es. maggioritario (raffronto con elezione precedente)
- DSY..i: differenza seggi liste, nel terzo turno o nel terzo voto es. maggioritario (raffronto con elezione precedente)
- DST..i: differenza seggi liste in complesso, ossia primo turno o primo voto + secondo turno o secondo voto (raffronto con elezione precedente)
- vice..i: nominativo del candidato vicepresidente
- nota..i: partiti inclusi in una lista (indice uguale a quello della lista cui la nota si riferisce)
- totv..i: totale voti, gruppo di liste
- tots..i: totale seggi, gruppo di liste
- ncomplementari: nome dei voti complementari (voti non attribuiti né a liste né a candidati, ma da conteggiare ai fini del calcolo delle percentuali di liste o candidati; default: Voti in bianco)
- complementari: voti complementari
- complementari2: voti complementari, secondo turno o secondo voto
- DC: differenza voti complementari (raffronto con elezione precedente)
- DCX: differenza voti complementari, nel secondo turno o nel secondo voto es. maggioritario (raffronto con elezione precedente)
- invalidi: voti invalidi, considerati ai fini del calcolo delle percentuali
- invalidi2: voti invalidi, considerati ai fini del calcolo delle percentuali, nel secondo turno o nel secondo voto
- valide: schede valide, in sistemi con panachage
- valide2: schede valide, in sistemi con panachage, nel secondo turno o nel secondo voto
- nulteriori: nome dei voti ulteriori (voti non attribuiti né a liste né a candidati, esclusi ai fini del calcolo delle percentuali di liste o candidati)
- ulteriori: voti ulteriori
- ulteriori2: voti ulteriori, secondo turno o secondo voto
- DU: differenza voti ulteriori (raffronto con elezione precedente)
- DUX: differenza voti ulteriori, nel secondo turno o nel secondo voto es. maggioritario (raffronto con elezione precedente)
- biancheb: schede bianche, ballottaggio (solo amministrative)
- bianche: schede bianche
- bianche2: schede bianche, secondo turno o secondo voto
- bianche3: schede bianche, terzo voto
- nulleb: schede nulle, ballottaggio (solo amministrative)
- nulle: schede nulle
- nulle2: schede nulle, secondo turno o secondo voto
- nulle3: schede nulle, terzo voto
- votantib: votanti, ballottaggio (solo amministrative)
- votanti: votanti
- votanti2: votanti, secondo turno o secondo voto
- votanti3: votanti, terzo voto
- disperse: schede disperse
- emesse: schede emesse
- elettorib: elettori, ballottaggio (solo amministrative)
- elettori: elettori
- elettori2: elettori, secondo turno o secondo voto
- elettori3: elettori, terzo voto
- avotanti: votanti nel turno di ballottaggio annullato
- aelettori: elettori nel turno di ballottaggio annullato
- DB: differenza schede bianche (raffronto con elezione precedente)
- DBX: differenza schede bianche, secondo turno o secondo voto (raffronto con elezione precedente)
- DBY: differenza schede bianche, terzo turno o terzo voto (raffronto con elezione precedente)
- DN: differenza schede nulle (raffronto con elezione precedente)
- DNX: differenza schede nulle, secondo turno o secondo voto (raffronto con elezione precedente)
- DNY: differenza schede nulle, terzo turno o terzo voto (raffronto con elezione precedente)
- DI: differenza voti invalidi (raffronto con elezione precedente)
- DIX: differenza voti invalidi, secondo turno o secondo voto (raffronto con elezione precedente)
- DIY: differenza voti invalidi, terzo turno o terzo voto (raffronto con elezione precedente)
- DV: differenza votanti, secondo turno o secondo voto [ex votantiv]
- DVX: differenza votanti, secondo turno o secondo voto (raffronto con elezione precedente)
- DVY: differenza votanti, terzo turno o terzo voto (raffronto con elezione precedente)
- url: url della fonte
- istituto: nome dell'istituto che ha divulgato i risultati (default: Ministero dell'interno)
- fonti: più fonti, o fonti cartacee
- eletti: numero dei candidati eletti (se corrispondente l'ordine progressivo di proclamazione)
- tipo: tipo, per sottotitoli (1: Primo turno/Secondo turno; 2: Maggioritario/Proporzionale; ita17 automatizza voti ottenuti dalle liste non collegate)
- sistema: sistema (
ita17
automatizza voti ottenuti nel maggioritario dalle liste non collegate;cominf
automatizza voti ottenuti dalle liste collegate al rispettivo candidato sindaco nei comuni inferiori)
candidati
Parametri
- f..i: formazione politica
- i..i: numero complessivo dei candidati proclamati eletti
- x..i: nome del candidato (nominativo con wikilink)
- h..i: nome del candidato (nominativo senza wikilink)
- y..i: cognome del candidato
- link..i: eventuale disambiguante
- j..i: numero di preferenze
- nota..i: nome della nota
- e..i: ente di opzione
- ref..i: nome dell'opzione
- opzione..i: contenuto dell'opzione
- valore..i: parametro booleano; compilato con Senato ritorna cifra individuale
Utilizzo da un altro modulo
local p = {}
local getArgs = require('Modulo:Arguments').getArgs
local cfg = mw.loadData('Modulo:Partiti/Configurazione')
local function formatnum(a)
if tonumber(a) then if tonumber(a) == 0 then return '–' else return mw.getLanguage('it'):formatNum(tonumber(a)) or '–' end
else return '–'
end
end
local function differenza(a, b)
local a = tonumber(a)
local b = tonumber(b)
if a and b then x = a - b
else x = '–'
end
return x
end
local function percentuale(a, b)
local a = tonumber(a)
local b = tonumber(b)
if a and b then
x = string.format('%.2f', a / b * 100)
y = string.gsub(x, "%.", "%,")
return y
else return '–'
end
end
local function colore(lista)
local a = mw.text.decode(lista)
local link = mw.ustring.find(a, '%[%[')
if link then
local b = mw.ustring.sub(a, link+2)
local linkfine = mw.ustring.find(b, '%]%]')
local delink = mw.ustring.sub(a, link+2, link+linkfine)
local piped = mw.ustring.find(delink, '%|')
if piped then
a = mw.ustring.sub(delink, 0, piped-1)
else
a = delink
end
elseif mw.ustring.find(a, '%(') then
abbr = mw.ustring.sub(a, 0, mw.ustring.find(a, '%(')-2)
end
local nome = cfg.alias[a] or a
local hex = cfg.colore[nome] or cfg.colore[abbr]
return hex or '#C0C0C0'
end
function p.eletto(frame)
local args = getArgs(frame)
return ' <span style="font-weight:bold">▸<span style="font-size:88%">'..(args['carica'] or 'Eletto')..'</span></span>'
end
function p.tabella(frame)
local args = getArgs(frame)
local index = {}
local data = {}
if args['tipo'] == 'ita17' then equival = true end
if (tonumber(args['d1']) and ((tonumber(args['b1']) or not args['b1']))) then eletto = true end
if args['sistema'] == 'liste' and not args['voti1'] then liste = true end
if args['sistema'] == 'mista' then mista = true end
if args['sistema'] == 'duplice' then duplice = true end
if args['sistema'] == 'individuale' and not (args['cand1'] or args['c1']) then individuale = true end
if args['sistema'] == 'ita17' or args['sistema'] == 'cominf' then idem = true eletto = true end
local i = 0
for ris = 1, 60 do i = i + 1
if args['l'..i] or args['g'..i] or args['p'..i] or args['c'..i] or args['part'..i] or args['cand'..i] or args['totv'..i] or args['sc'..i] or args['sa'..i] or args['listino'..i] then table.insert(index, i) end
if args['b'..i] then ammball = true end
if args['d'..i] then disg = true end
if args['v'..i] then voti = true end
if args['s'..i] or args['seggi'..i] or liste or mista or duplice then seggio = true end
if args['g'..i] then gruppi = true end
if args['n'..i] then collegate = true end
if args['n'..i] and args['c'..i] then simul = true end
if (args['c'..i] and not disg) or args['cand'..i] then diretta = true end
if args['vbis'..i] then votibis = true end
if args['ball'..i] then ball = true end
if args['sbis'..i] or mista or duplice then seggiosec = true end
if args['vter'..i] then votiter = true end
if args['ster'..i] or duplice then seggioter = true end
if args['nota'..i] then note = true end
end
if votibis or ball or mista or duplice then colbis = true end
if votiter or duplice then colter = true end
if voti and seggiosec and not votibis then doppia = true end
local val = 1
local vind = 3
local vliste = 2
local vmista = 2
local vdup = 2
totb = 0
totd = 0
totv = 0 + (tonumber(args['altri']) or 0) + (tonumber(args['invalidi']) or 0)
tots = 0
totva = 0
totvbis = 0 + (tonumber(args['altri2']) or 0) + (tonumber(args['invalidi2']) or 0)
totsbis = 0
totvter = 0
totster = 0
while (args['v'..val] or args['voti'..val] or args['c'..val] or args['totv'..val] or args['sc'..val] or args['sa'..val] or args['listino'..val] or (individuale and args[tonumber(vind)]) or (liste and args[tonumber(vliste)]) or (mista and args[tonumber(vmista)]) or (duplice and args[tonumber(vdup)])) do
data[val] = {
b = tonumber(args['b'..val]) or 0,
d = tonumber(args['d'..val]) or 0,
v = tonumber(args['v'..val]) or tonumber(args['voti'..val] or (individuale and tonumber(args[tonumber(vind)])) or (liste and tonumber(args[tonumber(vliste)])) or (mista and tonumber(args[tonumber(vmista)])) or (duplice and tonumber(args[tonumber(vdup)]))) or 0,
s = tonumber(args['s'..val] or args['sc'..val] or args['sa'..val] or args['listino'..val]) or tonumber(args['seggi'..val] or (liste and tonumber(args[tonumber(vliste+1)])) or (mista and tonumber(args[tonumber(vmista+1)])) or (duplice and tonumber(args[tonumber(vdup+1)]))) or 0,
va = tonumber(args['aball'..val]) or 0,
vbis = tonumber(args['vbis'..val] or args['ball'..val]) or (mista and tonumber(args[tonumber(vmista+2)]) or (duplice and tonumber(args[tonumber(vdup + 2)]))) or 0,
sbis = tonumber(args['sbis'..val]) or (mista and tonumber(args[tonumber(vmista+3)]) or (duplice and tonumber(args[tonumber(vdup + 3)]))) or 0,
vter = tonumber(args['vter'..val]) or (duplice and tonumber(args[tonumber(vdup + 4)])) or 0,
ster = tonumber(args['ster'..val]) or (duplice and tonumber(args[tonumber(vdup + 5)])) or 0,
}
totb = totb + data[val].b
totd = totd + data[val].d
totv = idem and totd or totv + data[val].v
tots = tots + data[val].s
totva = totva + data[val].va
totvbis = equival and totv or totvbis + data[val].vbis
totsbis = totsbis + data[val].sbis
totvter = totvter + data[val].vter
totster = totster + data[val].ster
val = val + 1
vind = vind + 3
vliste = vliste + 3
vmista = vmista + 5
vdup = vdup + 7
end
bianche = args['bianche']
nulle = args['nulle']
bianche2 = equival and args['bianche'] or args['bianche2']
nulle2 = equival and args['nulle'] or args['nulle2']
votanti = (args['invalidi'] and (args['valide'] and (args['invalidi'] + args['valide']) or totv)) or args['votanti']
votanti2 = (args['invalidi2'] and (args['valide2'] and (args['invalidi2'] + args['valide2']) or totvbis)) or equival and args['votanti'] or args['votanti2']
elettori2 = equival and args['elettori'] or args['elettori2']
colonne = 5 + (ammball and 2 or 0) + (disg and 3 or 0) + (gruppi and 1 or 0) + (colbis and 2 or 0) + (seggiosec and 2 or 0) + (args['DV1'] and 1 or 0) + (args['DS1'] and 1 or 0) + (args['DVX1'] and 1 or 0) + (args['DSX1'] and 1 or 0) + (colter and 3 or 0) + (args['DVY1'] and 1 or 0) + (args['DSY1'] and 1 or 0) + (args['DST1'] and 1 or 0) + (args['aball1'] and 2 or 0) + (args['vice1'] and 1 or 0) + ((diretta and seggio) and 1 or 0)
cospan = 2 + ((diretta or individuale) and 1 or 0) + ((gruppi and disg) and 0 or gruppi and 1 or 0) + (args['vice1'] and 1 or 0)
if votanti and votanti - (args['valide'] and (tonumber(args['valide']) or 0) or totv) < 0 then dvotanti = ' <span style="color:#EB0000;font-weight:bold;height:30px>Numero votanti inferiore a voti validi</span>' errori = true
elseif votanti2 and (votanti2 - (tonumber(args['valide2'] or totvbis)) < 0) or (votantib and (votantib - totb < 0)) then dvotanti = ' <span style="color:#EB0000;font-weight:bold;height:30px>Numero votanti inferiore a voti validi nel secondo voto</span>' errori = true
end
if bianche and (votanti - bianche - nulle - (args['d1'] and totd or args['valide'] or (totv - (args['invalidi'] or 0))) ~= 0) then dinvalidi = ' <span style="color:#EB0000;font-weight:bold;height:30px>Complesso voti invalidi errato</span>' errori = true end
local root = mw.html.create('table'):addClass('wikitable sortable'):css('text-align', 'right')
row = root:tag('tr')
if args['c1'] or args['cand1'] or (args['g1'] and args['d1']) or individuale then
row:tag('th')
:wikitext(args['g1'] and 'Gruppi' or 'Candidati')
:attr('colspan', args['vice1'] and 3 or 2)
:attr('rowspan', ((args['b1'] or args['ball1']) and not args['vice1']) and 2 or 1)
end
if ammball then
row:tag('th')
:wikitext('Ballottaggio')
:attr('colspan', 2)
row:tag('th')
:wikitext('Primo turno')
:attr('colspan', 2)
end
if disg and not ammball then
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
end
if colbis or colter then
row:tag('th')
:wikitext(gruppi and 'Gruppi/Liste' or 'Liste')
:attr('rowspan', colter and 3 or 2)
:attr('colspan', (args['cand1'] or args['c1'] or individuale) and 1 or gruppi and 3 or 2)
row:tag('th')
:wikitext((args['ball1'] or args['tipo'] == '1') and 'Primo turno' or args['tipo'] == '2' and 'Maggioritario' or 'Proporzionale')
:attr('colspan', (seggio and 3 or 2) + (args['DV1'] and 1 or 0) + (args['DS1'] and 1 or 0))
:attr('rowspan', colter and 2 or 1)
if args['aball1'] then
row:tag('th')
:wikitext('Secondo turno<br/><small>(annullato)</small>')
:attr('colspan', 2)
end
row:tag('th')
:wikitext((args['ball1'] or args['tipo'] == '1') and 'Secondo turno' or args['tipo'] == '2' and 'Proporzionale' or 'Maggioritario')
:attr('colspan', (seggiosec and 3 or 2) + (colter and 3 or 0) + (args['DVX1'] and 1 or 0) + (args['DSX1'] and 1 or 0) + (args['DVY1'] and 1 or 0) + (args['DSY1'] and 1 or 0))
if seggiosec then
if args['DST1'] then
row:tag('th')
:wikitext('Seggi')
:attr('colspan', 2)
:attr('rowspan', colter and 2 or 1)
else
row:tag('th')
:wikitext('Totale<br/>seggi')
:attr('rowspan', colter and 3 or 2)
end
end
row = root:tag('tr')
if args['vice1'] then
row = root:tag('tr')
row:tag('th')
:wikitext('Presidente')
:attr('colspan', 2)
row:tag('th')
:wikitext('Vicepresidente')
end
if colter then
row:tag('th')
:wikitext('Primo turno')
:attr('colspan', 3 + (args['DVX1'] and 1 or 0) + (args['DSX1'] and 1 or 0))
row:tag('th')
:wikitext('Secondo turno')
:attr('colspan', 3 + (args['DVY1'] and 1 or 0) + (args['DSY1'] and 1 or 0))
row = root:tag('tr')
end
elseif doppia then
row:tag('th')
:wikitext('Liste')
:attr('rowspan', 2)
:attr('colspan', 2)
elseif args['c1'] or args['cand1'] or (args['g1'] and args['d1']) or individuale then
row:tag('th')
:wikitext('Liste')
:attr('rowspan', (args['b1'] or args['vice1']) and 2 or 1)
else
row:tag('th')
:wikitext('Liste')
:attr('colspan', gruppi and 3 or 2)
end
row:tag('th')
:wikitext('Voti')
:attr('rowspan', ((args['vice1'] and not args['ball1']) or args['b1'] or doppia) and 2 or 1)
row:tag('th')
:wikitext('%')
:attr('rowspan', ((args['vice1'] and not args['ball1']) or args['b1'] or doppia) and 2 or 1)
if args['DV1'] or args['percv1'] then
row:tag('th')
:wikitext('+/-')
end
if seggio then
row:tag('th')
:wikitext(args['vice1'] and 'Delegati' or 'Seggi')
:attr('rowspan', (args['b1'] or args['vice1']) and 2 or 1)
:attr('colspan', doppia and 3 + (args['DS1'] and 1 or 0) + (args['DSX1'] and 1 or 0) + (args['DST1'] and 1 or 0) or 1)
if (args['DS1'] or args['seggiv1']) and not doppia then
row:tag('th')
:wikitext('+/-')
end
end
if args['aball1'] then
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
end
if colbis or ammball or doppia then
if ammball or doppia then
row = root:tag('tr')
end
if colbis or ammball then
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
if args['DVX1'] then
row:tag('th')
:wikitext('+/-')
end
end
if seggiosec then
row:tag('th')
:wikitext(doppia and 'Magg.' or 'Seggi')
if args['DSX1'] then
row:tag('th')
:wikitext('+/-')
end
end
if ammball or colter or doppia then
if ammball or colter then
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
if args['DVY1'] then
row:tag('th')
:wikitext('+/-')
end
end
if colter or doppia then
row:tag('th')
:wikitext(doppia and 'Prop.' or 'Seggi')
if args['DSX1'] then
row:tag('th')
:wikitext('+/-')
end
end
end
if doppia or args['DST1'] then
row:tag('th')
:wikitext('Totale')
if args['DST1'] then
row:tag('th')
:wikitext('+/-')
end
end
end
if args['vice1'] and not args['ball1'] then
row = root:tag('tr')
row:tag('th')
:wikitext('Presidente')
:attr('colspan', 2)
row:tag('th')
:wikitext('Vicepresidente')
end
if individuale or liste or mista or duplice then
for k, v in ipairs(args) do
local i = 0
for valore = 1, 50 do i = i + 1
if individuale and tonumber(k) and ((k + 2)/3 == i) then
row = root:tag('tr')
row:tag('td')
:css('background-color', colore(args[k+1]))
row:tag('td')
:wikitext(v..((args['el'..((k+2)/3)] or (args['eletti'] and tonumber(args['eletti']) >= (k+2)/3)) and p.eletto(frame) or ''))
:css('text-align', 'left')
row:tag('td')
:wikitext(args[k+1])
:css('text-align', 'left')
row:tag('td')
:wikitext(formatnum(args[k+2]))
row:tag('td')
:wikitext(percentuale(args[k+2], totv))
if args['ball'..((k+2)/3)] then
row:tag('td')
:wikitext(formatnum(args['ball'..((k+2)/3)]))
row:tag('td')
:wikitext(percentuale(args['ball'..((k+2)/3)], totvbis))
end
elseif liste and tonumber(k) and ((k + 2)/3 == i) then
row = root:tag('tr')
row:tag('td')
:css('background-color', colore(v))
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(formatnum(args[k+1]))
row:tag('td')
:wikitext(percentuale(args[k+1], totv))
if args['DV1'] then
row:tag('td')
:wikitext(args['DV'..((k+2)/3)])
end
row:tag('td')
:wikitext(formatnum(args[k+2]))
if args['DS1'] then
row:tag('td')
:wikitext(args['DS'..((k+2)/3)])
end
elseif mista and tonumber(k) and ((k + 4)/5 == i) then
row = root:tag('tr')
row:tag('td')
:css('background-color', colore(v))
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(formatnum(args[k+1]))
row:tag('td')
:wikitext(percentuale(args[k+1], totv))
if args['DV1'] then
row:tag('td')
:wikitext(args['DV'..((k+4)/5)])
end
row:tag('td')
:wikitext(formatnum(args[k+2]))
if args['DS1'] then
row:tag('td')
:wikitext(args['DS'..((k+4)/5)])
end
row:tag('td')
:wikitext(formatnum(args[k+3]))
row:tag('td')
:wikitext(percentuale(args[k+3], totvbis))
if args['DVX1'] then
row:tag('td')
:wikitext(args['DVX'..((k+4)/5)])
end
row:tag('td')
:wikitext(args[k+4])
if args['DSX1'] then
row:tag('td')
:wikitext(args['DSX'..((k+4)/5)])
end
row:tag('td')
:wikitext(formatnum((tonumber(args[k+2]) or 0) + (tonumber(args[k+4]) or 0)))
if args['DST1'] then
row:tag('td')
:wikitext(args['DST'..((k+4)/5)])
end
elseif duplice and tonumber(k) and ((k + 6)/7 == i) then
row = root:tag('tr')
row:tag('td')
:css('background-color', colore(v))
row:tag('td')
:wikitext(v)
:css('text-align', 'left')
row:tag('td')
:wikitext(formatnum(args[k+1]))
row:tag('td')
:wikitext(percentuale(args[k+1], totv))
if args['DV1'] then
row:tag('td')
:wikitext(args['DV'..((k+6)/7)])
end
row:tag('td')
:wikitext(formatnum(args[k+2]))
if args['DS1'] then
row:tag('td')
:wikitext(args['DS'..((k+6)/7)])
end
row:tag('td')
:wikitext(formatnum(args[k+3]))
row:tag('td')
:wikitext(percentuale(args[k+3], totvbis))
if args['DVX1'] then
row:tag('td')
:wikitext(args['DVX'..((k+6)/7)])
end
row:tag('td')
:wikitext(args[k+4])
if args['DSX1'] then
row:tag('td')
:wikitext(args['DSX'..((k+6)/7)])
end
row:tag('td')
:wikitext(formatnum(args[k+5]))
row:tag('td')
:wikitext(percentuale(args[k+5], totvter))
if args['DVY1'] then
row:tag('td')
:wikitext(args['DVY'..((k+6)/7)])
end
row:tag('td')
:wikitext(args[k+6])
if args['DSY1'] then
row:tag('td')
:wikitext(args['DSY'..((k+6)/7)])
end
row:tag('td')
:wikitext(formatnum((tonumber(args[k+2]) or 0) + (tonumber(args[k+4]) or 0) + (tonumber(args[k+6]) or 0)))
if args['DST1'] then
row:tag('td')
:wikitext(args['DST'..((k+6)/7)])
end
end
end
end
else
for _, v in ipairs(index) do
row = root:tag('tr')
if args['a'..v] or args['g'..v] or (args['c'..v] and args['l'..v]) then
row:tag('td')
:css('background-color', colore(args['a'..v] or args['g'..v] or args['p'..v] or args['l'..v]))
:attr('rowspan', args['n'..v])
elseif (args['p'..v] or args['l'..v] or args['part'..v]) and not simul and not gruppi then
row:tag('td')
:css('background-color', colore(args['p'..v] or args['l'..v] or args['part'..v]))
elseif args['cand'..v] or args['c'..v] then
row:tag('td')
:css('background-color', '#C0C0C0')
end
if args['g'..v] then
row:tag('td')
:wikitext(args['g'..v])
:attr('rowspan', args['n'..v])
:attr('colspan', args['l'..v] and 1 or 2)
:css('text-align', 'left')
end
if args['c'..v] or args['cand'..v] then
row:tag('td')
:wikitext((args['c'..v] or args['cand'..v])..(((eletto and tonumber(v) == 1) or (args['el'..v]) or (args['eletti'] and (tonumber(args['eletti']) >= tonumber(v)))) and p.eletto(frame) or '')..((args['r'..v] and '<br/><small>'..args['r'..v]..'</small>') or ''))
:attr('rowspan', args['n'..v])
:css('text-align', 'left')
end
if args['vice'..v] then
row:tag('td')
:wikitext(args['vice'..v])
:attr('rowspan', args['n'..v])
:css('text-align', 'left')
end
if args['b'..v] then
row:tag('td')
:wikitext(formatnum(args['b'..v]))
:attr('rowspan', args['n'..v])
row:tag('td')
:wikitext(percentuale(args['b'..v], totb))
:attr('rowspan', args['n'..v])
else
if ammball and (args['c'..v] or args['g'..v]) then
row:tag('td')
:attr('colspan', 2)
:attr('rowspan', args['n'..v])
end
end
if (args['c'..v] or args['g'..v]) and disg then
row:tag('td')
:wikitext(formatnum(args['d'..v]))
:attr('rowspan', args['n'..v])
row:tag('td')
:wikitext(percentuale(args['d'..v], totd))
:attr('rowspan', args['n'..v])
end
if args['totv'..v] then lista = '↳ <span style="font-style:italic">Totale coalizione</span>'
elseif args['sc'..v] then lista = '<span style="font-style:italic;font-size:90%">Seggio del candidato classificatosi secondo</span>'
elseif args['sa'..v] then lista = '<span style="font-style:italic;font-size:90%">Seggio del gruppo di liste</span>'
elseif args['listino'..v] then lista = '<span style="font-style:italic;font-size:90%">Seggi della lista regionale</span>'
else lista = args['l'..v] or args['p'..v] or args['part'..v] or '–'
end
if args['l'..v] or args['p'..v] or args['part'..v] or args['cand'..v] or args['c'..v] or args['totv'..v] or args['sc'..v] or args['sa'..v] or args['listino'..v] then
row:tag('td')
:wikitext(lista..(args['nota'..v] and frame:expandTemplate{title = 'Efn', args = {args['nota'..v]}} or ''))
:css('text-align', 'left')
end
if args['l'..v] or args['g'..v] or args['p'..v] or args['part'..v] or args['cand'..v] or args['c'..v] or args['totv'..v] or args['sc'..v] or args['sa'..v] or args['listino'..v] or idem then
if args['totv'..v] or args['sc'..v] or args['sa'..v] or args['listino'..v] then
row:tag('td')
:wikitext(formatnum(args['totv'..v]))
:css('font-style', 'italic')
row:tag('td')
:wikitext(percentuale(args['totv'..v], totv))
:css('font-style', 'italic')
else
row:tag('td')
:wikitext(formatnum(args['v'..v] or args['voti'..v] or (idem and args['d'..v])))
row:tag('td')
:wikitext(percentuale(args['v'..v] or args['voti'..v] or (idem and args['d'..v]), totv))
end
end
if args['DV'..v] or args['percv'..v] then
row:tag('td')
:wikitext(args['DV'..v] or args['percv'..v])
:css('text-align', left)
end
if seggio or args['s'..v] or args['seggi'..v] or args['tots'..v] or args['sc'..v] or args['sa'..v] or args['listino'..v] then
if args['tots'..v] then
row:tag('td')
:wikitext(formatnum(args['tots'..v]))
:css('font-style', 'italic')
elseif args['sc'..v] or args['sa'..v] or args['listino'..v] then
row:tag('td')
:wikitext(formatnum(args['sc'..v] or args['sa'..v] or args['listino'..v]))
:css('font-style', 'italic')
else
row:tag('td')
:wikitext(formatnum(args['s'..v] or args['seggi'..v]))
end
end
if args['DS'..v] or args['seggiv'..v] then
row:tag('td')
:wikitext(args['DS'..v] or args['seggiv'..v])
:css('text-align', left)
end
if args['aball'..v] then
row:tag('td')
:wikitext(formatnum(args['aball'..v]))
row:tag('td')
:wikitext(percentuale(args['aball'..v], totva))
end
if (votibis and not collegate) or (votibis and args['g'..v] and not args['l'..v]) or (equival and args['l'..v]) or args['vbis'..v] or args['ball'..v] or doppia then
if not doppia then
row:tag('td')
:wikitext(formatnum(args['vbis'..v] or args['ball'..v] or ((equival and args['l'..v]) and args['v'..v])))
:attr('rowspan', args['n'..v])
row:tag('td')
:wikitext(percentuale(args['vbis'..v] or args['ball'..v] or ((equival and args['l'..v]) and args['v'..v]), totvbis))
:attr('rowspan', args['n'..v])
if args['DVX'..v] then
row:tag('td')
:wikitext(args['DVX'..v])
:css('text-align', left)
end
end
if seggiosec or args['sbis'..v] then
row:tag('td')
:wikitext(formatnum(args['sbis'..v]))
:attr('rowspan', args['n'..v])
if args['DSX'..v] then
row:tag('td')
:wikitext(args['DSX'..v])
:css('text-align', left)
end
end
if (votiter and not collegate) or (votiter and args['g'..v] and not args['l'..v]) or args['vter'..v] then
row:tag('td')
:wikitext(formatnum(args['vter'..v]))
:attr('rowspan', args['n'..v])
row:tag('td')
:wikitext(percentuale(args['vter'..v], totvter))
:attr('rowspan', args['n'..v])
if args['DVY'..v] then
row:tag('td')
:wikitext(args['DVY'..v])
:css('text-align', left)
end
if seggioter or args['ster'..v] then
row:tag('td')
:wikitext(formatnum(args['ster'..v]))
:attr('rowspan', args['n'..v])
if args['DSY'..v] then
row:tag('td')
:wikitext(args['DSY'..v])
:css('text-align', left)
end
end
end
if seggiosec then
if collegate then
row:tag('td')
:wikitext(formatnum(args['st'..v]))
:attr('rowspan', args['n'..v])
else
row:tag('td')
:wikitext(formatnum((tonumber(args['s'..v]) or 0) + (tonumber(args['sbis'..v]) or 0) + (seggioter and (tonumber(args['ster'..v]) or 0) or 0)))
if args['DST'..v] then
row:tag('td')
:wikitext(args['DST'..v])
:css('text-align', left)
end
end
end
end
end
end
if args['complementari'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(args['ncomplementari'] or 'Voti in bianco')
:css('text-align', 'left')
:attr('colspan', cospan)
row:tag('td')
:wikitext(formatnum(args['complementari']))
row:tag('td')
:wikitext(percentuale(args['complementari'], totv))
if args['DV1'] then
row:tag('td')
:wikitext(args['DC'])
end
if seggio then
row:tag('td')
:wikitext('–')
if args['DS1'] then
row:tag('td')
:wikitext('–')
end
end
if args['complementari2'] then
row:tag('td')
:wikitext(formatnum(args['complementari2']))
row:tag('td')
:wikitext(percentuale(args['complementari2'], totv))
end
if args['DVX1'] then
row:tag('td')
:wikitext(args['DCX'])
end
if seggiosec then
row:tag('td')
:wikitext('–')
if args['DSX1'] then
row:tag('td')
:wikitext('–')
end
row:tag('td')
:wikitext('–')
if args['DST1'] then
row:tag('td')
:wikitext('–')
end
end
end
if args['invalidi'] and not args['votanti'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('Voti invalidi')
:css('text-align', 'left')
:attr('colspan', cospan)
row:tag('td')
:wikitext(formatnum(args['invalidi']))
row:tag('td')
:wikitext(percentuale(args['invalidi'], totv))
if args['DV1'] then
row:tag('td')
:wikitext(args['DI'])
end
if seggio then
row:tag('td')
:wikitext('–')
if args['DS1'] then
row:tag('td')
:wikitext('–')
end
end
if args['invalidi2'] then
row:tag('td')
:wikitext(formatnum(args['invalidi2']))
row:tag('td')
:wikitext(percentuale(args['invalidi2'], totvbis))
end
if args['DVX1'] then
row:tag('td')
:wikitext(args['DIX'])
end
if seggiosec then
row:tag('td')
:wikitext('–')
if args['DSX1'] then
row:tag('td')
:wikitext('–')
end
row:tag('td')
:wikitext('–')
if args['DST1'] then
row:tag('td')
:wikitext('–')
end
end
end
row = root:tag('tr'):addClass('sortbottom')
row:tag('th')
:wikitext('Totale')
:css('text-align', 'left')
:attr('colspan', cospan)
if ammball then
row:tag('th')
:wikitext(formatnum(totb))
:css('text-align', 'right')
row:tag('th')
:wikitext(100)
:css('text-align', 'right')
end
if disg then
row:tag('th')
:wikitext(formatnum(totd))
:css('text-align', 'right')
row:tag('th')
:wikitext(100)
:css('text-align', 'right')
row:tag('th')
end
row:tag('th')
:wikitext(formatnum(idem and totd or totv))
:css('text-align', 'right')
row:tag('th')
:wikitext(100)
:css('text-align', 'right')
if args['DV1'] then
row:tag('th')
end
if seggio then
row:tag('th')
:wikitext(tots)
:css('text-align', 'right')
if args['DS1'] then
row:tag('th')
:wikitext(args['DS'])
:css('text-align', 'right')
end
end
if colbis then
if args['aball1'] then
row:tag('th')
:wikitext(formatnum(totva))
:css('text-align', 'right')
row:tag('th')
:wikitext(100)
:css('text-align', 'right')
end
row:tag('th')
:wikitext(formatnum(equival and totv or totvbis))
:css('text-align', 'right')
row:tag('th')
:wikitext(100)
:css('text-align', 'right')
if args['DVX1'] then
row:tag('th')
end
end
if seggiosec then
row:tag('th')
:wikitext(formatnum(totsbis))
:css('text-align', 'right')
if args['DSX1'] then
row:tag('th')
:wikitext(args['DSX'])
:css('text-align', 'right')
end
end
if colter then
row:tag('th')
:wikitext(formatnum(totvter))
:css('text-align', 'right')
row:tag('th')
:wikitext(100)
:css('text-align', 'right')
if args['DVY1'] then
row:tag('th')
end
row:tag('th')
:wikitext(formatnum(totster))
:css('text-align', 'right')
if args['DSY1'] then
row:tag('th')
:wikitext(args['DSY'])
:css('text-align', 'right')
end
end
if seggiosec then
row:tag('th')
:wikitext(formatnum(tots + totsbis + totster or 0))
:css('text-align', 'right')
if args['DST1'] then
row:tag('th')
:wikitext(args['DST'])
:css('text-align', 'right')
end
end
if args['votanti'] or args['elettori'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:attr('colspan', colonne)
end
if args['valide'] or args['invalidi'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(args['valide'] and 'Schede valide' or 'Voti validi')
:attr('colspan', cospan)
:css('text-align', 'left')
row:tag('td')
:wikitext(formatnum(args['valide'] or (totv - args['invalidi'])))
row:tag('td')
:wikitext('–')
if args['DV1'] then
row:tag('td')
:wikitext('–')
end
if colbis then
if seggio then
row:tag('td')
end
if args['DS1'] then
row:tag('td')
end
row:tag('td')
:wikitext(formatnum(args['valide2'] or (totvbis - args['invalidi2'])))
row:tag('td')
:wikitext('–')
if args['DVX1'] then
row:tag('td')
:wikitext('–')
end
end
end
if votanti then
if args['ulteriori'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(args['nulteriori'] or 'Nessuna lista')
:attr('colspan', cospan)
:css('text-align', 'left')
row:tag('td')
:wikitext(formatnum(args['ulteriori']))
row:tag('td')
:wikitext(percentuale(args['ulteriori'], votanti))
if args['DV1'] then
row:tag('td')
:wikitext(args['DU'])
end
if colbis then
if seggiosec then
row:tag('td')
end
if args['DS1'] then
row:tag('td')
end
row:tag('td')
:wikitext(formatnum(args['ulteriori2']))
row:tag('td')
:wikitext(percentuale(args['ulteriori2'], votanti2))
if args['DVX1'] then
row:tag('td')
:wikitext(args['DUX'])
end
end
end
row = root:tag('tr'):addClass('sortbottom')
if args['bianche'] and args['nulle'] then
row:tag('td')
:wikitext('Schede bianche'..(dinvalidi or ''))
:attr('colspan', cospan)
:css('text-align', 'left')
if ammball then
row:tag('td')
:wikitext(formatnum(args['biancheb']))
row:tag('td')
:wikitext(percentuale(args['biancheb'], args['votantib']))
end
row:tag('td')
:wikitext(formatnum(args['bianche']))
row:tag('td')
:wikitext(percentuale(args['bianche'], votanti))
if args['DV1'] then
row:tag('td')
:wikitext(args['DB'])
end
if colbis then
if seggiosec then
row:tag('td')
end
if args['DS1'] then
row:tag('td')
end
if args['aball1'] then
row:tag('td')
:wikitext(formatnum(args['abianche']))
row:tag('td')
:wikitext(percentuale(args['abianche'], args['avotanti']))
end
row:tag('td')
:wikitext(formatnum(bianche2))
row:tag('td')
:wikitext(percentuale(bianche2, votanti2))
if args['DVX1'] then
row:tag('td')
:wikitext(args['DBX'])
end
if colter then
if args['DSX1'] then
row:tag('td')
end
row:tag('td')
row:tag('td')
:wikitext(formatnum(args['bianche3']))
row:tag('td')
:wikitext(percentuale(args['bianche3'], args['votanti3']))
if args['DVY1'] then
row:tag('td')
:wikitext(args['DBY'])
end
end
end
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('Schede nulle'..(dinvalidi or ''))
:attr('colspan', cospan)
:css('text-align', 'left')
if ammball then
row:tag('td')
:wikitext(formatnum(args['nulleb']))
row:tag('td')
:wikitext(percentuale(args['nulleb'], args['votantib']))
end
row:tag('td')
:wikitext(formatnum(args['nulle']))
row:tag('td')
:wikitext(percentuale(args['nulle'], votanti))
if args['DV1'] then
row:tag('td')
:wikitext(args['DN'])
end
if colbis then
if seggiosec then
row:tag('td')
end
if args['DS1'] then
row:tag('td')
end
if args['aball1'] then
row:tag('td')
:wikitext(formatnum(args['anulle']))
row:tag('td')
:wikitext(percentuale(args['anulle'], args['avotanti']))
end
row:tag('td')
:wikitext(formatnum(nulle2))
row:tag('td')
:wikitext(percentuale(nulle2, votanti2))
if args['DVX1'] then
row:tag('td')
:wikitext(args['DNX'])
end
if colter then
if args['DSX1'] then
row:tag('td')
end
row:tag('td')
row:tag('td')
:wikitext(formatnum(args['nulle3']))
row:tag('td')
:wikitext(percentuale(args['nulle3'], args['votanti3']))
if args['DVY1'] then
row:tag('td')
:wikitext(args['DNY'])
end
end
end
else
row:tag('td')
:wikitext(args['valide'] and 'Schede invalide' or 'Voti invalidi')
:attr('colspan', cospan)
:css('text-align', 'left')
if ammball then
row:tag('td')
:wikitext(formatnum(differenza(args['votantib'], totb)))
row:tag('td')
:wikitext(percentuale(differenza(args['votantib'], totb), args['votantib']))
end
row:tag('td')
:wikitext(formatnum(args['votanti'] and differenza(args['votanti'], (disg and totd or args['valide'] or (args['ulteriori'] and args['ulteriori'] + totv) or totv)) or args['invalidi']))
row:tag('td')
:wikitext(percentuale((args['votanti'] and differenza(args['votanti'], (disg and totd or args['valide'] or (args['ulteriori'] and args['ulteriori'] + totv) or totv)) or args['invalidi']), votanti))
if args['DV1'] then
row:tag('td')
:wikitext(args['DI'])
end
if colbis then
if seggio then
row:tag('td')
end
if args['DS1'] then
row:tag('td')
end
if args['aball1'] then
row:tag('td')
:wikitext(formatnum(differenza(args['avotanti'], totva)))
row:tag('td')
:wikitext(percentuale(differenza(args['avotanti'], totva), totva))
end
row:tag('td')
:wikitext(formatnum(equival and differenza(args['votanti'], totvbis) or args['votanti2'] and differenza(args['votanti2'], (args['valide2'] or (args['ulteriori2'] and args['ulteriori2'] + totvbis) or totvbis)) or args['invalidi2']))
row:tag('td')
:wikitext(percentuale(equival and differenza(args['votanti'], totvbis) or (args['votanti2'] and differenza(args['votanti2'], (args['valide2'] or (args['ulteriori2'] and args['ulteriori2'] + totvbis) or totvbis)) or args['invalidi2']), votanti2))
if args['DVX1'] then
row:tag('td')
:wikitext(args['DIX'])
end
if colter then
if args['DSX1'] then
row:tag('td')
end
row:tag('td')
row:tag('td')
:wikitext(formatnum(differenza(args['votanti3'], totvter)))
row:tag('td')
:wikitext(percentuale(differenza(args['votanti3'], totvter), args['votanti3']))
if args['DVY1'] then
row:tag('td')
:wikitext(args['DIY'])
end
end
end
end
row = root:tag('tr'):addClass('sortbottom')
row:tag('th')
:wikitext('Votanti'..(dvotanti or ''))
:attr('colspan', cospan)
:css('text-align', 'left')
if ammball then
row:tag('th')
:wikitext(formatnum(args['votantib']))
:css('text-align', 'right')
row:tag('th')
:wikitext(percentuale(args['votantib'], args['elettorib']))
:css('text-align', 'right')
end
row:tag('th')
:wikitext(formatnum(votanti))
:css('text-align', 'right')
row:tag('th')
:wikitext(args['elettori'] and percentuale(votanti, args['elettori']) or '')
:css('text-align', 'right')
if args['DV1'] then
row:tag('th')
:wikitext(args['DV'])
:css('text-align', 'right')
end
if colbis then
if seggiosec then
row:tag('th')
end
if args['DS1'] then
row:tag('th')
end
if args['aball1'] then
row:tag('th')
:wikitext(formatnum(args['avotanti']))
:css('text-align', 'right')
row:tag('th')
:wikitext(args['aelettori'] and percentuale(args['avotanti'], args['aelettori']) or '')
:css('text-align', 'right')
end
row:tag('th')
:wikitext(formatnum(votanti2))
:css('text-align', 'right')
row:tag('th')
:wikitext(elettori2 and percentuale(votanti2, elettori2) or '')
:css('text-align', 'right')
if args['DVX1'] then
row:tag('th')
:wikitext(args['DVX'])
:css('text-align', 'right')
end
if colter then
if args['DSX1'] then
row:tag('th')
end
row:tag('th')
row:tag('th')
:wikitext(formatnum(tonumber(args['votanti3'])))
:css('text-align', 'right')
row:tag('th')
:wikitext(args['elettori3'] and percentuale(args['votanti3'], args['elettori3']))
:css('text-align', 'right')
if args['DVY1'] then
row:tag('th')
:wikitext(args['DVY'])
:css('text-align', 'right')
end
end
end
end
if args['emesse'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('Schede disperse')
:attr('colspan', cospan)
:css('text-align', 'left')
row:tag('td')
:wikitext(formatnum(args['emesse'] - totv))
row:tag('td')
:wikitext(percentuale((args['emesse'] - totv), args['emesse']))
row = root:tag('tr'):addClass('sortbottom')
row:tag('th')
:wikitext('Schede emesse')
:attr('colspan', cospan)
:css('text-align', 'left')
row:tag('th')
:wikitext(formatnum(args['emesse']))
:css('text-align', 'right')
row:tag('th')
:wikitext(percentuale(args['emesse'], args['elettori']))
:css('text-align', 'right')
end
if args['elettori'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('Elettori')
:attr('colspan', cospan)
:css('text-align', 'left')
if ammball then
row:tag('td')
:wikitext(formatnum(args['elettorib']))
row:tag('td')
end
row:tag('td')
:wikitext(formatnum(args['elettori']))
row:tag('td')
if args['DV1'] then
row:tag('td')
end
if colbis then
if args['DS1'] then
row:tag('td')
end
if seggiosec then
row:tag('td')
end
if args['aball1'] then
row:tag('td')
:wikitext(formatnum(args['aelettori']))
row:tag('td')
end
row:tag('td')
:wikitext(formatnum(elettori2))
if args['DVX1'] then
row:tag('td')
end
row:tag('td')
if colter then
if args['DSX1'] then
row:tag('td')
end
row:tag('td')
row:tag('td')
:wikitext(formatnum(tonumber(args['elettori3'])))
row:tag('td')
if args['DVY1'] then
row:tag('td')
end
end
end
end
if args['app1'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(args['app1'])
:attr('colspan', colonne)
:css('text-align', 'left')
:css('font-size', '90%')
:css('font-style', 'italic')
if args['app2'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(args['app2'])
:attr('colspan', colonne)
:css('text-align', 'left')
:css('font-size', '90%')
:css('font-style', 'italic')
end
end
if args['quorum'] or args['data'] or args['fonti'] or args['url'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:attr('colspan', colonne)
end
if args['quorum'] == 'Senato' then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('<span style="font-weight:bold">Nota:</span> quorum del 65% non raggiunto; ripartizione dei seggi a livello regionale')
:attr('colspan', colonne)
:css('text-align', 'left')
:css('font-size', '90%')
end
if args['data'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('<span style="font-weight:bold">Data:</span> '..args['data']..(args['data2'] and ' (primo turno); '..args['data2']..' (secondo turno)' or ''))
:attr('colspan', colonne)
:css('text-align', 'left')
:css('font-size', '90%')
end
if args['fonti'] or args['url'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('<span style="font-weight:bold">Fonti:</span> '..(args['fonti'] or '['..args['url']..' '..(args['istituto'] or 'Ministero dell’interno')..']'))
:attr('colspan', colonne)
:css('text-align', 'left')
:css('font-size', '90%')
end
return tostring(root)..(note and frame:expandTemplate{title = 'Gruppo di note'} or '')..(errori and '[[Categoria:Errori di compilazione del template risultati]]' or '')
end
function p.candidati(frame)
local args = getArgs(frame)
local index = {}
local i = 0
for data = 1, 40 do i = i + 1
if args['y'..i] then table.insert(index, i) end
if args['nota'..i] == 'R' then rinuncia = true end
if args['opzione'..i] then opzione = true end
end
colspan = 3 + (args['j1'] and 1 or 0) + (args['e1'] and 1 or 0)
local root = mw.html.create('table'):addClass('wikitable sortable')
row = root:tag('tr')
row:tag('th')
:wikitext('Liste')
:attr('colspan', 2)
row:tag('th')
:wikitext('Candidati')
if args['j1'] then
row:tag('th')
:wikitext(args['valore'] == 'Senato' and 'Cifra<br/>indiv.' or 'Voti')
end
if args['e1'] then
row:tag('th')
:wikitext(args['ente'] or 'Collegio')
end
for _, v in ipairs(index) do
row = root:tag('tr')
if args['f'..v] then
row:tag('td')
:css('background-color', colore(args['f'..v]))
:attr('rowspan', args['i'..v])
row:tag('td')
:wikitext(args['f'..v])
:attr('rowspan', args['i'..v])
end
nominativo = args['x'..v] and args['x'..v]..' '..args['y'..v]
candidato = args['h'..v] and ''..args['h'..v]..' '..args['y'..v]..'' or '[['..nominativo..(args['link'..v] and ' ('..args['link'..v]..')|'..nominativo..'' or '') ..']]'
simbolo = args['nota'..v] and (args['nota'..v] == 'R' and '⭯ ' or '⇄ ') or ''
nota = (args['nota'..v] and args['nota'..v] ~= 'R') and ' <sup>'..args['nota'..v]..' </sup>' or ''
row:tag('td')
:wikitext('<span data-sort-value="'..args['y'..v]..'">'..simbolo..candidato..nota..'</span>')
if args['j'..v] then
row:tag('td')
:wikitext(formatnum(args['j'..v]))
:css('text-align', 'right')
end
if args['e'..v] then
row:tag('td')
:wikitext(args['e'..v])
end
end
if opzione then
row = root:tag('tr'):addClass('sortbottom'):tag('td'):attr('colspan', colspan)
if rinuncia then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('⭯ Rinuncia al seggio')
:css('font-size', '90%')
:attr('colspan', colspan)
end
for _, v in ipairs(index) do
if args['opzione'..v] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('<sup>'..args['ref'..v]..'</sup> '..args['opzione'..v])
:css('font-size', '90%')
:attr('colspan', colspan)
end
end
end
return tostring(root)
end
return p