Modulo:Controllo certificazioni: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
evito falsi positivi |
miglioro performance |
||
(2 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 pattern = '{{ *[Aa]lbum(.-)|%s*numero dischi ' .. v .. '%s*=(.+)$'▼
if subcontent2 then▼
local pre, post = ('|' .. subcontent):match(pattern)
-- evita falsi positivi col template Brano musicale▼
if subcontent1:match('{{ *[Bb]rano musicale *\|') then break end▼
▲ -- evita falsi positivi col template Brano musicale
subcontent2 = subcontent2:sub(1, 2000)▼
local n = 0▼
▲ for s, c in string.gmatch(subcontent2, '(.-)([|{}]+)') do
▲ local n = 0
if s:match('FIMI') then▼
for s, c in string.gmatch(post, '(.-)([|{}]+)') do
return cat▼
▲ if s:match('FIMI') then
end▼
▲ return cat
end
n = n if n == 0 and c:match('|$') or n < 0 then
break
▲ end
end
end
|