Modulo:Controllo certificazioni: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
semplifico
miglioro performance
 
(7 versioni intermedie di uno stesso utente non sono mostrate)
Riga 7:
if not year or year > 2008 then return end
local content = mw.title.getCurrentTitle():getContent()
content = content:gsub('{{ *[Aa]lbum[ \n]*|', '\r{{Album\n|') .. '\r'
local awards = { "d'oro", "di platino", "di diamante" }
-- non usare gsplit, è molto più lento di gmatch
for _, v in ipairs(awards) do
local for subcontent =in string.matchgmatch(content, '{{Album\n|%s*numero dischi ' .. v .. '%s*=(.+-)$\r') do
for _, v in ipairs(awards) do
if subcontent then
local pattern = '^(.-)|%s*numero dischi ' .. v .. '%s*=(.+)$'
local n = 0
local pre, post = ('|' .. subcontent):match(pattern)
for s, c in string.gmatch(subcontent, '(.*)([|{}]+)') do
if s:match('FIMI')post then
-- evita falsi positivi col template Brano musicale
return cat
if pre:match('{{ *[Bb]rano musicale *|') then break end
end
npost = n + select(2, cpost:gsubsub('{{'1, '')2000)
local n = 0
n = n - select(2, c:gsub('}}', ''))
iffor ns, ==c 0in and c:matchstring.gmatch(post, '(.-)([|${}]+)') or n < 0 thendo
if s:match('FIMI') then
return
return cat
end
n = n + select(2, c:gsub('{{', ''))
n = n - select(2, c:gsub('}}', ''))
if n == 0 and c:match('|$') or n < 0 then
return break
end
end
end