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 numero intero compreso fra 1 e 60; esso corrisponde al numero della riga all'interno della tabella.
- gruppo..i: gruppo di liste o partiti/liste
- cand..i: nominativo del candidato
- el..i: candidato eletto (booleano)
- eletti..i: numero dei candidati eletti (per ordine di voto)
- carica: nome della carica monocratica
- listino..i: listino regionale cui il candidato è collegato
- a..i: area politica del candidato
- n..i: numero di liste collegate (rowspan)
- ng..i: numero dei candidati collegati ad un gruppo (rowspan)
- b..i: voti ottenuti al ballottaggio dal solo candidato in elezione diretta con liste
- d..i: voti diretti ottenuti dal solo candidato in elezione diretta con liste
- lista..i: lista OPPURE listac..i: lista collegata ad altre liste OPPURE part..i: partito
- ann..i: annotazione relativa alla lista, se comprendente più partiti
- app..i: apparentamento relativo alla lista, da indicare con la stessa lettera utilizzata per contraddistinguere il collegamento col candidato concorrente al primo turno
- voti..i: voti ottenuti da candidati/liste
- seggi..i: seggi ottenuti da candidati/liste
- sa..i: seggio ottenuto dal candidato collegato al gruppo (seggio in prededuzione)
- sc..i: seggio ottenuto dal candidato classificatosi secondo
- sr..i: seggi regionali ottenuti dal listino
- aball1, aball2: voti ottenuti da candidati/liste nel turno annullato di ballottaggio
- ball1, ball2: voti ottenuti da candidati/liste nel ballottaggio
- votibis..i: voti ottenuti da liste; secondo turno o secondo voto, es. maggioritario [ex vm..i]
- seggibis..i: seggi ottenuti da liste; secondo turno o secondo voto, es. maggioritario [ex sm..i]
- votiter..i: voti ottenuti da liste; terzo turno o terzo voto, es. maggioritario
- seggiter..i: seggi ottenuti da liste; terzo turno o terzo voto, es. maggioritario
- diffvoti..i: differenza voti liste (raffronto con elezione precedente) [ex percv..i]
- diffseggi..i: differenza seggi liste (raffronto con elezione precedente) [ex seggiv..i]
- diffvotibis..i: differenza voti liste; secondo turno o secondo voto (raffronto con elezione precedente)
- diffseggibis..i: differenza seggi liste; secondo turno o secondo voto (raffronto con elezione precedente)
- diffvotiter..i: differenza voti liste; terzo turno o terzo voto (raffronto con elezione precedente)
- diffseggiter..i: differenza seggi liste, terzo turno o terzo voto (raffronto con elezione precedente)
- diffseggitot..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)
- altrinome: nome degli altri voti, non attribuiti né a liste né a candidati, conteggiati ai fini della determinazione delle percentuali di liste o candidati; default: Voti dispersi
- altri: altri voti, non attribuiti né a liste né a candidati, conteggiati ai fini della determinazione delle percentuali di liste o candidati
- altribis: altri voti, non attribuiti né a liste né a candidati, conteggiati ai fini della determinazione delle percentuali di liste o candidati; secondo turno o secondo voto
- altriter: altri voti, non attribuiti né a liste né a candidati, conteggiati ai fini della determinazione delle percentuali di liste o candidati; terzo turno o terzo voto
- DA: differenza altri voti (raffronto con elezione precedente)
- DABIS: differenza altri voti; secondo turno o secondo voto (raffronto con elezione precedente)
- DATER: differenza altri voti; terzo turno o terzo voto (raffronto con elezione precedente)
- invalidi: voti non validi, conteggiati ai fini della determinazione delle percentuali di liste o candidati
- invalidibis: voti non validi, conteggiati ai fini della determinazione delle percentuali di liste o candidati; secondo turno o secondo voto
- invaliditer: voti non validi, conteggiati ai fini della determinazione delle percentuali di liste o candidati; terzo turno o terzo voto
- DI: differenza voti non validi, conteggiati ai fini della determinazione delle percentuali di liste o candidati (raffronto con elezione precedente)
- DIBIS: differenza voti non validi, conteggiati ai fini della determinazione delle percentuali di liste o candidati; secondo turno o secondo voto (raffronto con elezione precedente)
- DITER: differenza voti non validi, conteggiati ai fini della determinazione delle percentuali di liste o candidati; terzo turno o terzo voto (raffronto con elezione precedente)
- valide: schede valide, in sistemi con panachage
- validebis: schede valide, in sistemi con panachage; secondo turno o secondo voto
- valideter: schede valide, in sistemi con panachage; terzo turno o terzo voto
- ulteriorinome: nome degli ulteriori voti, non conteggiati ai fini della determinazione delle percentuali di liste o candidati
- ulteriori: ulteriori voti, non conteggiati ai fini della determinazione delle percentuali di liste o candidati
- ulterioribis: ulteriori voti, non conteggiati ai fini della determinazione delle percentuali di liste o candidati; secondo turno o secondo voto
- ulterioriter: ulteriori voti, non conteggiati ai fini della determinazione delle percentuali di liste o candidati; terzo turno o terzo voto
- DU: differenza ulteriori voti, non conteggiati ai fini della determinazione delle percentuali di liste o candidati (raffronto con elezione precedente)
- DUBIS: differenza ulteriori voti, non conteggiati ai fini della determinazione delle percentuali di liste o candidati; secondo turno o secondo voto (raffronto con elezione precedente)
- DUTER: differenza ulteriori voti, non conteggiati ai fini della determinazione delle percentuali di liste o candidati; terzo turno o terzoo voto (raffronto con elezione precedente)
- biancheb: schede bianche; ballottaggio (solo amministrative)
- bianche: schede bianche
- bianchebis: schede bianche; secondo turno o secondo voto
- biancheter: schede bianche; terzo turno o terzo voto
- diffbianche: differenza schede bianche (raffronto con elezione precedente)
- diffbianchebis: differenza schede bianche; secondo turno o secondo voto (raffronto con elezione precedente)
- diffbiancheter: differenza schede bianche; terzo turno o terzo voto (raffronto con elezione precedente)
- nulleb: schede nulle, ballottaggio (solo amministrative)
- nulle: schede nulle
- nullebis: schede nulle; secondo turno o secondo voto
- nulleter: schede nulle; terzo turno o terzo voto
- DN: differenza schede nulle, o differenza voti non validi in complesso (raffronto con elezione precedente)
- DNBIS: differenza schede nulle, o differenza voti non validi in complesso; secondo turno o secondo voto (raffronto con elezione precedente)
- DNTER: differenza schede nulle, o differenza voti non validi in complesso; terzo turno o terzo voto (raffronto con elezione precedente)
- votantib: votanti, ballottaggio (solo amministrative)
- votanti: votanti
- votantibis: votanti; secondo turno o secondo voto
- votantiter: votanti; terzo turno o terzo voto
- avotanti: votanti nel turno di ballottaggio annullato
- diffvotanti: differenza votanti [ex votantiv]
- diffvotantibis: differenza votanti; secondo turno o secondo voto (raffronto con elezione precedente)
- diffvotantiter: differenza votanti; terzo turno o terzo voto (raffronto con elezione precedente)
- disperse: schede disperse
- emesse: schede emesse
- elettorib: elettori, ballottaggio (solo amministrative)
- elettori: elettori
- elettoribis: elettori; secondo turno o secondo voto
- elettoriter: elettori; terzo turno o terzo voto
- aelettori: elettori nel turno di ballottaggio annullato
- nota: nota; se compilato con quorum, restituisce "quorum del 65% non raggiunto; ripartizione dei seggi a livello regionale"
- data1, data2: data primo turno, data secondo turno/ballottaggio
- 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 i candidati vengono proclamati eletti in base ad un ordine progressivo che inizia da 1 e fino al numero dei candidati da eleggere)
- tipo: titolo della cella che descrive la quota di ripartizione di voti/seggi (valori suggeriti:
1
: Primo turno + Secondo turno;2
: Maggioritario + Proporzionale; Default: Proporzionale + Maggioritario) - titolo: titolo della tabella (es. elezione suppletiva)
- sistema: sistema (
idem
automatizza il numero di voti ottenuti dalle singole liste non coalizzate, il cui valore è equivalente al numero di voti ottenuti dai rispettivi candidati collegati - elezioni nei comuni minori ed elezioni provinciali 1993-1998 - o a quello ottenuto dalle medesime liste nella quota proporzionale - elezioni politiche dal 2017 -)
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 percentuale(a, b)
local a = tonumber(a)
local b = tonumber(b)
if a and a > 0 then
if b and b > 0 then
x = string.format('%.2f', a / b * 100)
y = string.gsub(x, "%.", "%,")
return y
else return '' end
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 (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'] then individuale = true end
if args['sistema'] == 'idem' then
if args['cand1'] then trasf = true eletto = true
else equival = true
end
end
local i = 0
for ris = 1, 60 do i = i + 1
if args['n'..i] then collegate = true end
if args['gruppo'..i] then gruppi = true end
if args['b'..i] then ammball = true end
if args['d'..i] or trasf then disg = true end
if args['cand'..i] then cand = true end
if cand and not disg then diretta = true end
if args['lista'..i] then lista = true end
if args['part'..i] then part = true end
if args['voti'..i] then voti = true end
if args['seggi'..i] or liste or mista or duplice then seggio = true end
if args['votibis'..i] or equival then votibis = true end
if args['ball'..i] then ball = true end
if args['seggibis'..i] or mista or duplice then seggiosec = true end
if args['votiter'..i] then votiter = true end
if args['seggiter'..i] or duplice then seggioter = true end
if args['diffvoti'..i] then DV = true end
if args['diffseggi'..i] then DS = true end
if args['diffvotibis'..i] then DVBIS = true end
if args['diffseggibis'..i] then DSBIS = true end
if args['diffvotiter'..i] then DVTER = true end
if args['diffseggiter'..i] then DSTER = true end
if args['diffseggitot'..i] then DSTOT = true end
if args['lista'..i] or args['gruppo'..i] or args['listac'..i] or args['part'..i] or args['cand'..i] or args['sa'..i] or args['sc'..i] or args['sr'..i] or args['app'..i] then table.insert(index, i) end
if args['app'..i] then app = true end
if args['ann'..i] then ann = true end
end
if votibis or equival 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 and not equival 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['altribis']) or 0) + (tonumber(args['invalidibis']) or 0)
totsbis = 0
totvter = 0 + (tonumber(args['altriter']) or 0) + (tonumber(args['invaliditer']) or 0)
totster = 0
while (args['lista'..val] or args['gruppo'..val] or args['listac'..val] or args['cand'..val] or args['app'..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] = {
v = 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['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,
sg = tonumber(args['sa'..val] or args['sc'..val] or args['sr'..val]) or 0,
b = tonumber(args['b'..val]) or 0,
d = tonumber(args['d'..val]) or 0,
va = tonumber(args['aball'..val]) or 0,
vbis = tonumber(args['votibis'..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['seggibis'..val]) or (mista and tonumber(args[tonumber(vmista+3)]) or (duplice and tonumber(args[tonumber(vdup + 3)]))) or 0,
vter = tonumber(args['votiter'..val]) or (duplice and tonumber(args[tonumber(vdup + 4)])) or 0,
ster = tonumber(args['seggiter'..val]) or (duplice and tonumber(args[tonumber(vdup + 5)])) or 0,
}
totv = totv + data[val].v
tots = tots + data[val].s + data[val].sg
totb = totb + data[val].b
totd = trasf and totv or totd + data[val].d
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
bianched = trasf and args['bianche'] or args['bianched']
bianchebis = equival and args['bianche'] or args['bianchebis']
votantid = trasf and args['votanti'] or args['votantid']
votanti = (args['invalidi'] and not args['valide']) and totv or args['votanti']
votantibis = equival and args['votanti'] or ((args['invalidibis'] and not args['validebis']) and totvbis or args['votantibis'])
votantiter = (args['invaliditer'] and not args['valideter']) and totvter or args['votantiter']
if args['votantib'] then nullib = args['votantib'] - totb - (args['biancheb'] or 0) end
if votantid then nullid = votantid - totd - (bianched or 0) end
if votanti then nulli = (args['invalidi'] or (votanti - (args['valide'] or totv))) - (args['bianche'] or 0) - (args['ulteriori'] or 0) end
if votantibis then nullibis = (args['invalidibis'] or (votantibis - (args['validebis'] or totvbis))) - (bianchebis or 0) - (args['ulterioribis'] or 0) end
if votantiter then nulliter = (args['invaliditer'] or (votantiter - (args['valideter'] or totvter))) - (args['biancheter'] or 0) - (args['ulterioriter'] or 0) end
elettorid = trasf and args['elettori'] or args['elettorid']
elettoribis = equival and args['elettori'] or args['elettoribis']
colonne = 4 + ((part or individuale) and 1 or 0) + ((args['cand1'] and lista) and 1 or 0) + (seggio and 1 or 0) + (ammball and 2 or 0) + (disg and 2 or 0) + (gruppi and 1 or 0) + (colbis and 2 or 0) + (seggiosec and 2 or 0) + (DV and 1 or 0) + (DS and 1 or 0) + (DVBIS and 1 or 0) + (DSBIS and 1 or 0) + (colter and 3 or 0) + (DVTER and 1 or 0) + (DSTER and 1 or 0) + (DSTOT and 1 or 0) + (args['aball1'] and 2 or 0) + (args['vice1'] and 1 or 0)
cospan = 2 + ((diretta and (part or lista) or individuale or (gruppi and (args['cand1'] or not disg))) and 1 or 0) + (args['vice1'] and 1 or 0)
rowsub = colter and 3 or (colbis or ammball or doppia or args['vice1']) and 2 or 1
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 votantibis and (votantibis - (tonumber(args['validebis'] 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
elseif nullid and nullid < 0 then dvotanti = ' <span style="color:#EB0000;font-weight:bold;height:30px>Numero votanti inferiore a voti validi + invalidi</span>' errori = true
end
local root = mw.html.create('table'):addClass('wikitable sortable'):css('text-align', 'right')
row = root:tag('tr')
if args['titolo'] then
row:tag('caption')
:wikitext(args['titolo'])
end
if gruppi then
row:tag('th')
:wikitext(args['cand1'] and 'Partiti/Liste' or 'Gruppi')
:attr('colspan', 2)
:attr('rowspan', rowsub)
end
if args['cand1'] or individuale then
row:tag('th')
:wikitext('Candidati')
:attr('colspan', args['vice1'] and 3 or gruppi and 1 or 2)
:attr('rowspan', args['vice1'] and 1 or rowsub)
end
if ammball then
row:tag('th')
:wikitext('Ballottaggio')
:attr('colspan', 2)
:attr('rowspan', colter and 2 or 1)
row:tag('th')
:wikitext('Primo turno')
:attr('colspan', 2)
:attr('rowspan', colter and 2 or 1)
elseif disg then
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
end
if lista or part or liste or mista or duplice or individuale then
row:tag('th')
:wikitext((part or individuale) and 'Partiti' or 'Liste')
:attr('colspan', (args['cand1'] or individuale or gruppi) and 1 or 2)
:attr('rowspan', rowsub)
end
if colbis then
row:tag('th')
:wikitext((args['ball1'] or args['tipo'] == '1') and 'Primo turno' or args['tipo'] == '2' and 'Maggioritario' or diretta and 'Voti diretti' or 'Proporzionale')
:attr('colspan', (seggio and 3 or 2) + (DV and 1 or 0) + (DS 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 diretta and 'Voti di lista' or 'Maggioritario')
:attr('colspan', (seggiosec and 3 or 2) + (colter and 3 or 0) + (DVBIS and 1 or 0) + (DSBIS and 1 or 0) + (DVTER and 1 or 0) + (DSTER and 1 or 0))
if seggiosec then
if DSTOT 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', rowsub)
end
end
if colter then
row = root:tag('tr')
row:tag('th')
:wikitext('Primo turno')
:attr('colspan', 3 + (DVBIS and 1 or 0) + (DSBIS and 1 or 0))
row:tag('th')
:wikitext('Secondo turno')
:attr('colspan', 3 + (DVTER and 1 or 0) + (DSTER and 1 or 0))
end
row = root:tag('tr')
if args['vice1'] then
row:tag('th')
:wikitext('Presidente')
:attr('colspan', 2)
row:tag('th')
:wikitext('Vicepresidente')
end
if ammball then
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
end
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
if DV then
row:tag('th')
:wikitext('+/-')
end
if seggio then
row:tag('th')
:wikitext('Seggi')
if DS then
row:tag('th')
:wikitext('+/-')
end
end
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
if DVBIS then
row:tag('th')
:wikitext('+/-')
end
if seggiosec then
row:tag('th')
:wikitext('Seggi')
if DSBIS then
row:tag('th')
:wikitext('+/-')
end
end
if colter then
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
if DVTER then
row:tag('th')
:wikitext('+/-')
end
if seggioter then
row:tag('th')
:wikitext('Seggi')
if DSTER then
row:tag('th')
:wikitext('+/-')
end
end
end
if DSTOT then
row:tag('th')
:wikitext('Totale')
row:tag('th')
:wikitext('+/-')
end
else
if doppia or ammball or args['vice1'] then
row:tag('th')
:wikitext('Voti')
:attr('rowspan', 2)
row:tag('th')
:wikitext('%')
:attr('rowspan', 2)
if DV then
row:tag('th')
:wikitext('+/-')
:attr('rowspan', 2)
end
if doppia then
row:tag('th')
:wikitext('Seggi')
:attr('colspan', 3 + (DS and 1 or 0) + (DSBIS and 1 or 0) + (DSTOT and 1 or 0))
row = root:tag('tr')
row:tag('th')
:wikitext('Prop.')
if DS then
row:tag('th')
:wikitext('+/-')
end
row:tag('th')
:wikitext('Magg.')
if DSBIS then
row:tag('th')
:wikitext('+/-')
end
row:tag('th')
:wikitext('Totale')
if DSTOT then
row:tag('th')
:wikitext('+/-')
end
else
row:tag('th')
:wikitext('Seggi')
:attr('rowspan', 2)
if DS then
row:tag('th')
:wikitext('+/-')
:attr('rowspan', 2)
end
if ammball then
row = root:tag('tr')
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
end
end
else
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
if DV then
row:tag('th')
:wikitext('+/-')
end
if seggio then
row:tag('th')
:wikitext('Seggi')
if DS then
row:tag('th')
:wikitext('+/-')
end
end
end
end
if args['aball1'] then
row:tag('th')
:wikitext('Voti')
row:tag('th')
:wikitext('%')
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 DV then
row:tag('td')
:wikitext(args['diffvoti'..((k+2)/3)])
end
row:tag('td')
:wikitext(formatnum(args[k+2]))
if DS then
row:tag('td')
:wikitext(args['diffseggi'..((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 DV then
row:tag('td')
:wikitext(args['diffvoti'..((k+4)/5)])
end
row:tag('td')
:wikitext(formatnum(args[k+2]))
if DS then
row:tag('td')
:wikitext(args['diffseggi'..((k+4)/5)])
end
row:tag('td')
:wikitext(formatnum(args[k+3]))
row:tag('td')
:wikitext(percentuale(args[k+3], totvbis))
if DVBIS then
row:tag('td')
:wikitext(args['diffvotibis'..((k+4)/5)])
end
row:tag('td')
:wikitext(args[k+4])
if DSBIS then
row:tag('td')
:wikitext(args['diffseggibis'..((k+4)/5)])
end
row:tag('td')
:wikitext(formatnum((tonumber(args[k+2]) or 0) + (tonumber(args[k+4]) or 0)))
if DSTOT then
row:tag('td')
:wikitext(args['diffseggitot'..((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 DV then
row:tag('td')
:wikitext(args['diffvoti'..((k+6)/7)])
end
row:tag('td')
:wikitext(formatnum(args[k+2]))
if DS then
row:tag('td')
:wikitext(args['diffseggi'..((k+6)/7)])
end
row:tag('td')
:wikitext(formatnum(args[k+3]))
row:tag('td')
:wikitext(percentuale(args[k+3], totvbis))
if DVBIS then
row:tag('td')
:wikitext(args['diffvotibis'..((k+6)/7)])
end
row:tag('td')
:wikitext(args[k+4])
if DSBIS then
row:tag('td')
:wikitext(args['diffseggibis'..((k+6)/7)])
end
row:tag('td')
:wikitext(formatnum(args[k+5]))
row:tag('td')
:wikitext(percentuale(args[k+5], totvter))
if DVTER then
row:tag('td')
:wikitext(args['diffvotiter'..((k+6)/7)])
end
row:tag('td')
:wikitext(args[k+6])
if DSTER then
row:tag('td')
:wikitext(args['diffseggiter'..((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 DSTOT then
row:tag('td')
:wikitext(args['diffseggitot'..((k+6)/7)])
end
end
end
end
else
for _, v in ipairs(index) do
row = root:tag('tr')
rspan = (args['n'..v] or 1) + ((args['cand'..v] and ((trasf and seggio) or not trasf) and args['lista'..(v+1)] and not args['cand'..(v+1)] and not (args['app'..v] and not args['lista'..v] and not (args['lista'..(v+2)] and not args['cand'..(v+2)]))) and 1 or 0) + ((((args['listac'..v] and not equival) or (args['n'..v] and gruppi)) and not (trasf and not seggio) and not equival) and 1 or 0) + ((args['cand'..v] and (args['sa'..v] or args['sc'..v] or args['sr'..v])) and 1 or 0)
if ((args['listac'..v] and equival) or args['lista'..v] or args['part'..v]) and not (cand and collegate) and not gruppi then
row:tag('td')
:css('background-color', args['col'..v] or colore(args['a'..v] or args['lista'..v] or args['part'..v] or args['listac'..v]))
elseif args['gruppo'..v] or (args['cand'..v] and (args['lista'..v] or args['sa'..v] or args['sc'..v] or args['sr'..v] or args['app'..v])) or (args['listac'..v] and args['n'..v]) then
row:tag('td')
:css('background-color', args['col'..v] or colore(args['a'..v] or args['gruppo'..v] or args['lista'..v] or args['listac'..v] or (args['app'..v] and '#C0C0C0')))
:attr('rowspan', args['ng'..v] or rspan)
elseif args['cand'..v] and not gruppi then
row:tag('td')
:css('background-color', '#C0C0C0')
end
if args['gruppo'..v] then
row:tag('td')
:wikitext(args['gruppo'..v])
:attr('rowspan', args['ng'..v] or rspan)
:attr('colspan', (lista and not args['lista'..v]) and 2 or 1)
:css('text-align', 'left')
end
if args['cand'..v] then
row:tag('td')
:wikitext(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['listino'..v] and '<br/><small>'..args['listino'..v]..'</small>') or ''))
:attr('rowspan', rspan)
:css('text-align', 'left')
end
if args['vice'..v] then
row:tag('td')
:wikitext(args['vice'..v])
:attr('rowspan', rspan)
:css('text-align', 'left')
end
if args['b'..v] then
row:tag('td')
:wikitext(formatnum(args['b'..v]))
:attr('rowspan', rspan)
row:tag('td')
:wikitext(percentuale(args['b'..v], totb))
:attr('rowspan', rspan)
else
if ammball and (args['cand'..v] or args['gruppo'..v]) then
row:tag('td')
:attr('colspan', 2)
:attr('rowspan', rspan)
end
end
if args['n'..v] then
local w = v
toth = 0
totx = 0
toty = 0
totq = 0
totz = 0
while args['lista'..w] or args['cand'..w] or args['listac'..w] or args['gruppo'..w] or args['app'..w] do
data[w] = {
h = (args['voti'..w] and args['app'..w]) and 0 or tonumber(args['voti'..w]) or 0,
x = tonumber(args['voti'..w]) or 0,
y = tonumber(args['seggi'..w]) or 0,
t = tonumber(args['sa'..w] or args['sc'..w] or args['sr'..w]) or 0,
q = tonumber(args['seggibis'..w]) or 0,
z = tonumber(args['seggiter'..w]) or 0,
}
toth = (toth + data[w].h) or 0
totx = (totx + data[w].x) or 0
toty = (toty + data[w].y + data[w].t) or 0
totq = (totq + data[w].q) or 0
totz = (totz + data[w].z) or 0
w = w + 1
if w > v - 1 + (tonumber(args['n'..v]) or 0) then break end
end
end
if (args['cand'..v] or args['gruppo'..v]) and disg then
row:tag('td')
:wikitext(formatnum(trasf and (args['n'..v] and toth or args['voti'..v]) or args['d'..v]))
:attr('rowspan', rspan)
row:tag('td')
:wikitext(percentuale(trasf and (args['n'..v] and toth or args['voti'..v]) or args['d'..v], totd))
:attr('rowspan', rspan)
end
if args['cand'..v] and (args['sa'..v] or args['sc'..v] or args['sr'..v]) then
row:tag('td')
:wikitext('<span style="font-style:italic;font-size:90%">'..(args['sa'..v] and 'Seggio al candidato collegato' or args['sc'..v] and 'Seggio del candidato classificatosi secondo' or args['sr'..v] and 'Seggi della lista regionale')..'</span>')
:css('text-align', 'left')
row:tag('td')
:wikitext('–')
row:tag('td')
:wikitext('–')
row:tag('td')
:wikitext(args['sa'..v] or args['sc'..v] or args['sr'..v])
row = root:tag('tr')
end
applista = args['app'..v] and '<span style="font-weight:bold"> '..args['app'..v]..'</span>'
dato = args['lista'..v] or args['listac'..v] or args['part'..v] or applista or '–'
if (lista or part or app) and not (args['gruppo'..v] and not args['lista'..v]) then
row:tag('td')
:wikitext(dato..(args['ann'..v] and frame:expandTemplate{title = 'Efn', args = {args['ann'..v]}} or '')..((args['app'..v] and args['lista'..v]) and applista or ''))
:css('text-align', 'left')
end
row:tag('td')
:wikitext(formatnum(args['voti'..v]))
row:tag('td')
:wikitext(percentuale(args['voti'..v], totv))
if DV then
row:tag('td')
:wikitext(args['diffvoti'..v] or '–')
:css('text-align', left)
end
if seggio then
if args['lista'..v] or args['gruppo'..v] or args['listac'..v] or args['part'..v] or args['app'..v] then
row:tag('td')
:wikitext(formatnum(args['seggi'..v]))
if DS then
row:tag('td')
:wikitext(args['diffseggi'..v] or '–')
:css('text-align', left)
end
end
end
if (args['listac'..v] and ((args['listac'..(v+1)] and args['n'..(v+1)]) or not args['listac'..(v+1)]) and not equival) or (cand and not (trasf and not seggio) and args['lista'..v] and not args['cand'..v] and (args['cand'..(v+1)] or not (args['lista'..(v+1)] or args['app'..(v+1)])) and not (args['app'..(v-1)] and not args['lista'..(v-1)])) or (gruppi and args['lista'..v] and not args['gruppo'..v] and (args['gruppo'..(v+1)] or not args['lista'..(v+1)])) then
row = root:tag('tr')
row:tag('td')
:wikitext('↳ <span style="font-style:italic">Totale coalizione</span>')
:css('text-align', 'left')
row:tag('td')
:wikitext(formatnum(totx))
:css('font-style', 'italic')
row:tag('td')
:wikitext(percentuale(totx, totv))
:css('font-style', 'italic')
if DV then
row:tag('td')
:wikitext('–')
end
if seggio then
row:tag('td')
:wikitext(formatnum(toty))
:css('font-style', 'italic')
if DS then
row:tag('td')
:wikitext('–')
end
end
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 ((args['lista'..v] and not gruppi) or (args['listac'..v] and args['n'..v]) or args['gruppo'..v])) or args['ball'..v] or doppia then
if not doppia then
row:tag('td')
:wikitext(formatnum((equival and (args['n'..v] and totx or args['voti'..v]) or args['votibis'..v] or args['ball'..v])))
:attr('rowspan', rspan)
row:tag('td')
:wikitext(percentuale((equival and (args['n'..v] and totx or args['voti'..v]) or args['votibis'..v] or args['ball'..v]), totvbis))
:attr('rowspan', rspan)
if DVBIS then
row:tag('td')
:wikitext(args['diffvotibis'..v] or '–')
:attr('rowspan', rspan)
end
end
if seggiosec or args['seggibis'..v] then
row:tag('td')
:wikitext(formatnum(args['seggibis'..v]))
:attr('rowspan', rspan)
if DSBIS then
row:tag('td')
:wikitext(args['diffseggibis'..v] or '–')
:attr('rowspan', rspan)
end
end
if (votiter and not collegate) or (votiter and args['gruppo'..v] and not args['lista'..v]) or args['votiter'..v] then
row:tag('td')
:wikitext(formatnum(args['votiter'..v]))
:attr('rowspan', rspan)
row:tag('td')
:wikitext(percentuale(args['votiter'..v], totvter))
:attr('rowspan', rspan)
if DVTER then
row:tag('td')
:wikitext(args['diffvotiter'..v] or '–')
:attr('rowspan', rspan)
end
if seggioter or args['seggiter'..v] then
row:tag('td')
:wikitext(formatnum(args['seggiter'..v]))
:attr('rowspan', rspan)
if DSTER then
row:tag('td')
:wikitext(args['diffseggiter'..v] or '–')
:attr('rowspan', rspan)
end
end
end
if seggiosec then
if args['n'..v] then
row:tag('td')
:wikitext(formatnum(toty + totq + (seggioter and totz or 0)))
:attr('rowspan', rspan)
else
row:tag('td')
:wikitext(formatnum((tonumber(args['seggi'..v]) or 0) + (tonumber(args['seggibis'..v]) or 0) + (seggioter and (tonumber(args['seggiter'..v]) or 0) or 0)))
end
if DSTOT then
row:tag('td')
:wikitext(args['diffseggitot'..v] or '–')
:attr('rowspan', rspan)
end
end
end
end
end
if args['altri'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(args['altrinome'] or 'Voti dispersi')
:css('text-align', 'left')
:attr('colspan', cospan)
row:tag('td')
:wikitext(formatnum(args['altri']))
row:tag('td')
:wikitext(percentuale(args['altri'], totv))
if DV then
row:tag('td')
:wikitext(args['DA'])
end
if seggio then
row:tag('td')
:wikitext('–')
if DS then
row:tag('td')
:wikitext('–')
end
end
if args['altribis'] then
row:tag('td')
:wikitext(formatnum(args['altribis']))
row:tag('td')
:wikitext(percentuale(args['altribis'], totvbis))
if DVBIS then
row:tag('td')
:wikitext(args['DABIS'])
end
if seggiosec then
row:tag('td')
:wikitext('–')
if DSBIS then
row:tag('td')
:wikitext('–')
end
end
end
if args['altriter'] then
row:tag('td')
:wikitext(formatnum(args['altriter']))
row:tag('td')
:wikitext(percentuale(args['altriter'], totvter))
if DVTER then
row:tag('td')
:wikitext(args['DATER'])
end
row:tag('td')
:wikitext('–')
if DSTER then
row:tag('td')
:wikitext('–')
end
row:tag('td')
:wikitext('–')
end
if DSTOT then
row:tag('td')
:wikitext('–')
end
end
if args['invalidi'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('Voti non validi')
:css('text-align', 'left')
:attr('colspan', cospan)
row:tag('td')
:wikitext(formatnum(args['invalidi']))
row:tag('td')
:wikitext(percentuale(args['invalidi'], totv))
if DV then
row:tag('td')
:wikitext(args['DI'])
end
if seggio then
row:tag('td')
:wikitext('–')
if DS then
row:tag('td')
:wikitext('–')
end
end
if args['invalidibis'] then
row:tag('td')
:wikitext(formatnum(args['invalidibis']))
row:tag('td')
:wikitext(percentuale(args['invalidibis'], totvbis))
if DVBIS then
row:tag('td')
:wikitext(args['DIBIS'])
end
if seggiosec then
row:tag('td')
:wikitext('–')
if DSBIS then
row:tag('td')
:wikitext('–')
end
end
end
if args['invaliditer'] then
row:tag('td')
:wikitext(formatnum(args['invaliditer']))
row:tag('td')
:wikitext(percentuale(args['invaliditer'], totvter))
if DVTER then
row:tag('td')
:wikitext(args['DITER'])
end
row:tag('td')
:wikitext('–')
if DSTER then
row:tag('td')
:wikitext('–')
end
row:tag('td')
:wikitext('–')
end
if DSTOT then
row:tag('td')
:wikitext('–')
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(totv))
:css('text-align', 'right')
row:tag('th')
:wikitext(100)
:css('text-align', 'right')
if DV then
row:tag('th')
end
if seggio then
row:tag('th')
:wikitext(tots)
:css('text-align', 'right')
if DS then
row:tag('th')
:wikitext(args['diffseggi'])
: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(totvbis))
:css('text-align', 'right')
row:tag('th')
:wikitext(100)
:css('text-align', 'right')
if DVBIS then
row:tag('th')
end
end
if seggiosec then
row:tag('th')
:wikitext(formatnum(totsbis))
:css('text-align', 'right')
if DSBIS then
row:tag('th')
:wikitext(args['diffseggibis'])
: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 DVTER then
row:tag('th')
end
row:tag('th')
:wikitext(formatnum(totster))
:css('text-align', 'right')
if DSTER then
row:tag('th')
:wikitext(args['diffseggiter'])
:css('text-align', 'right')
end
end
if seggiosec then
row:tag('th')
:wikitext(formatnum(tots + totsbis + totster or 0))
:css('text-align', 'right')
if DSTOT then
row:tag('th')
:wikitext(args['diffseggitot'])
:css('text-align', 'right')
end
end
if args['valide'] or votanti or votantid then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:attr('colspan', colonne)
if args['valide'] or args['invalidi'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('th')
:wikitext(args['valide'] and 'Schede valide' or 'Voti validi')
:attr('colspan', cospan)
:css('text-align', 'left')
row:tag('th')
:wikitext(formatnum(args['valide'] or (totv - args['invalidi'])))
:css('text-align', 'right')
row:tag('th')
if DV then
row:tag('th')
end
if colbis then
if seggio then
row:tag('th')
end
if DS then
row:tag('th')
end
row:tag('th')
:wikitext(formatnum(args['validebis'] or (totvbis - args['invalidibis'])))
:css('text-align', 'right')
row:tag('th')
if DVBIS then
row:tag('th')
end
if colter then
if DSBIS then
row:tag('th')
end
row:tag('th')
row:tag('th')
:wikitext(formatnum(args['valideter'] or (totvter - args['invaliditer'])))
:css('text-align', 'right')
row:tag('th')
if DVTER then
row:tag('th')
end
end
end
end
if args['ulteriori'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext((args['ulteriorinome'] or 'Nessuna lista')..' <small>(% su votanti)</small>')
:attr('colspan', cospan)
:css('text-align', 'left')
row:tag('td')
:wikitext(formatnum(args['ulteriori']))
row:tag('td')
:wikitext(percentuale(args['ulteriori'], votanti))
if DV then
row:tag('td')
:wikitext(args['DU'])
end
if colbis then
if seggiosec then
row:tag('td')
end
if DS then
row:tag('td')
end
row:tag('td')
:wikitext(formatnum(args['ulterioribis']))
row:tag('td')
:wikitext(percentuale(args['ulterioribis'], votantibis))
if DVBIS then
row:tag('td')
:wikitext(args['DUBIS'])
end
if colter then
if DSBIS then
row:tag('td')
end
row:tag('td')
row:tag('td')
:wikitext(formatnum(args['ulterioriter']))
row:tag('td')
:wikitext(percentuale(args['ulterioriter'], votantiter))
if DVTER then
row:tag('td')
:wikitext(args['DUTER'])
end
end
end
end
if args['bianche'] or args['bianched'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('Schede bianche <small>(% su votanti)</small>')
: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
if disg then
row:tag('td')
:wikitext(formatnum(bianched))
row:tag('td')
:wikitext(percentuale(bianched, votantid))
if args['bianche'] then
row:tag('td')
end
end
if args['bianche'] then
row:tag('td')
:wikitext(formatnum(args['bianche']))
row:tag('td')
:wikitext(percentuale(args['bianche'], votanti))
if DV then
row:tag('td')
:wikitext(args['diffbianche'])
end
end
if colbis then
if seggiosec then
row:tag('td')
end
if DS 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(bianchebis))
row:tag('td')
:wikitext(percentuale(bianchebis, votantibis))
if DVBIS then
row:tag('td')
:wikitext(args['diffbianchebis'])
end
if colter then
if DSBIS then
row:tag('td')
end
row:tag('td')
row:tag('td')
:wikitext(formatnum(args['biancheter']))
row:tag('td')
:wikitext(percentuale(args['biancheter'], votantiter))
if DVTER then
row:tag('td')
:wikitext(args['diffbiancheter'])
end
end
end
end
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext(((args['bianche'] or args['bianched']) and 'Schede nulle' or args['valide'] and 'Schede non valide' or 'Voti non validi')..' <small>(% su votanti)</small>')
:attr('colspan', cospan)
:css('text-align', 'left')
if ammball then
row:tag('td')
:wikitext(formatnum(nullib))
row:tag('td')
:wikitext(percentuale(nullib, args['votantib']))
end
if disg then
row:tag('td')
:wikitext(formatnum(nullid))
row:tag('td')
:wikitext(percentuale(nullid, votantid))
if votanti then
row:tag('td')
end
end
if votanti then
row:tag('td')
:wikitext(formatnum(nulli))
row:tag('td')
:wikitext(percentuale(nulli, votanti))
if DV then
row:tag('td')
:wikitext((args['invalidi'] and not args['bianche'] and not args['ulteriori']) and args['DI'] or args['DN'])
end
if colbis then
if seggiosec then
row:tag('td')
end
if DS then
row:tag('td')
end
if args['aball1'] then
row:tag('td')
:wikitext(formatnum(args['avotanti'] - totva - (args['abianche'] or 0)))
row:tag('td')
:wikitext(percentuale(args['avotanti'] - totva - (args['abianche'] or 0), args['avotanti']))
end
row:tag('td')
:wikitext(formatnum(nullibis))
row:tag('td')
:wikitext(percentuale(nullibis, votantibis))
if DVBIS then
row:tag('td')
:wikitext((args['invalidibis'] and not args['bianchebis'] and not args['ulterioribis']) and args['DIBIS'] or args['DNBIS'])
end
if colter then
if DSBIS then
row:tag('td')
end
row:tag('td')
row:tag('td')
:wikitext(formatnum(nulliter))
row:tag('td')
:wikitext(percentuale(nulliter, votantiter))
if DVTER then
row:tag('td')
:wikitext((args['invaliditer'] and not args['biancheter'] and not args['ulterioriter']) and args['DITER'] or args['DNTER'])
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
if disg then
row:tag('th')
:wikitext(formatnum(votantid))
:css('text-align', 'right')
row:tag('th')
:wikitext(percentuale(votantid, elettorid))
:css('text-align', 'right')
if votanti then
row:tag('th')
end
end
if votanti then
row:tag('th')
:wikitext(formatnum(votanti))
:css('text-align', 'right')
row:tag('th')
:wikitext(percentuale(votanti, args['elettori']))
:css('text-align', 'right')
if DV then
row:tag('th')
:wikitext(args['diffvotanti'])
:css('text-align', 'right')
end
if colbis then
if seggiosec then
row:tag('th')
end
if DS then
row:tag('th')
end
if args['aball1'] then
row:tag('th')
:wikitext(formatnum(args['avotanti']))
:css('text-align', 'right')
row:tag('th')
:wikitext(percentuale(args['avotanti'], args['aelettori']))
:css('text-align', 'right')
end
row:tag('th')
:wikitext(formatnum(votantibis))
:css('text-align', 'right')
row:tag('th')
:wikitext(percentuale(votantibis, elettoribis))
:css('text-align', 'right')
if DVBIS then
row:tag('th')
:wikitext(args['diffvotantibis'])
:css('text-align', 'right')
end
if colter then
if DSBIS then
row:tag('th')
end
row:tag('th')
row:tag('th')
:wikitext(formatnum(votantiter))
:css('text-align', 'right')
row:tag('th')
:wikitext(percentuale(votantiter, args['elettoriter']))
:css('text-align', 'right')
if DVTER then
row:tag('th')
:wikitext(args['diffvotantiter'])
: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
end
if args['elettori'] or args['elettorid'] 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
if disg then
row:tag('td')
:wikitext(formatnum(elettorid))
row:tag('td')
if args['elettori'] then
row:tag('td')
end
end
if args['elettori'] then
row:tag('td')
:wikitext(formatnum(args['elettori']))
row:tag('td')
if DV then
row:tag('td')
end
if colbis then
if DS 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(elettoribis))
if DVBIS then
row:tag('td')
end
row:tag('td')
if colter then
if DSBIS then
row:tag('td')
end
row:tag('td')
row:tag('td')
:wikitext(formatnum(args['elettoriter']))
row:tag('td')
if DVTER then
row:tag('td')
end
end
end
end
end
if app or args['nota'] or args['data'] or args['fonti'] or args['url'] then
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:attr('colspan', colonne)
end
if app or args['nota'] then
if app then testo = 'È contraddistinta da una medesima lettera la lista, già collegata a un candidato non ammesso al ballottaggio, che abbia effettuato un successivo apparentamento'
elseif args['nota'] == 'quorum' then testo = 'quorum del 65% non raggiunto; ripartizione dei seggi a livello regionale'
else testo = args['nota']
end
row = root:tag('tr'):addClass('sortbottom')
row:tag('td')
:wikitext('<span style="font-weight:bold">Nota:</span> <span style="font-style:italic">'.. testo..'</span>')
: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)..(ann 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