Modulo:Quorum: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
solo elezioni di amministratori valide
correggo
 
(Una versione intermedia di uno stesso utente non è mostrata)
Riga 21:
local quorum = 0
local elections, candidates, votes = {}, {}, {}
local pattern = '%[%[(W%a+:Amministratori/Elezioni/.[^|%[%]]-)[|%]][^%[}]+s[iì]'
for election in string.gmatch(source or '', pattern) do
if not source or #candidates == 8 then
Riga 36:
local candidate = election:match('Elezioni/([^/]+)')
table.insert(candidates, string.format('[[User:%s|%s]]', candidate, candidate))
votes[#candidates] = 0
for heading, section in string.gmatch(content, '\n==+ *([^\n]-) *==+(.-)\r') do
if heading == 'Pro' or heading == 'Contro' then
local _, count = section:gsub('\n#[^#:*\n][^\n]-%a', '')
quorum = quorum + count
votes[#candidates] = (votes[#candidates] or 0) + count
end
end