Modulo:Fumetto e animazione/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m versione attuale
semplifico
Riga 67:
return adj
end
 
-- ========================================================================
-- Individua e restituisce l'anno in una stringa, se presente
-- ========================================================================
local function get_year(str)
if annostr then
annoreturn = tonumber(args['data fine']str:match('%d%d%d%d'))
end
end
 
Riga 78 ⟶ 87:
local function categorizza(args, base_name, table_name, lowercase)
local categories = {}
local anno = tonumberget_year(args['data inizio']:match) or get_year('%d%d%d%ddata_fine'))
local adj
local annoindex = 1
while true do
local name_value = args[base_name]
local adj
if name_value then
local name_value = args[base_name .. ' ' .. tostring(index)] or index == 1 and args[base_name]
if not name_value then break end
name_value = mDelink._main({ name_value })
if lowercase then name_value = mw.ustring.lower(name_value) end
if table_name == 'paese_TV' then
adj = get_adj(name_value, 'fp')
if adj and (adj ~= 'giapponesi' or args[base_name .. ' 2']) then
categories[#categories+1] = 'Serie televisive d\'animazione ' .. adj
end
elseif table_name == 'paese_film_DTV' then
adj = get_adj(name_value, 'mp')
if adj then
categories[#categories+1] = 'Film d\'animazione ' .. adj
if args['data inizio']anno then
categories[#categories+1] = 'Film ' .. adj .. ' del ' .. anno
anno = tonumber(args['data inizio']:match('%d%d%d%d'))
end
if anno == nil and args['data fine'] then
anno = tonumber(args['data fine']:match('%d%d%d%d'))
end
if anno then
categories[#categories+1] = 'Film ' .. adj .. ' del ' .. anno
end
end
elseif table_name == 'paese_webserie' then
Riga 125 ⟶ 130:
elseif table_name == 'etichetta_sottotipo' or table_name == 'editore_sottotipo' then
categories[#categories+1] = get_category(args.sottotipo .. ' ' .. name_value, table_name)
else
local category = get_category(name_value, table_name)
if category then
categories[#categories+1] = category
end
end
local index = 2index + 1
while true do
name_value = args[base_name .. ' ' .. tostring(index)]
if name_value then
name_value = mDelink._main({ name_value })
if lowercase then name_value = mw.ustring.lower(name_value) end
if table_name == 'paese_TV' then
adj = get_adj(name_value, 'fp')
if adj then
categories[#categories+1] = 'Serie televisive d\'animazione ' .. adj
end
elseif table_name == 'paese_film_DTV' then
adj = get_adj(name_value, 'mp')
if adj then
categories[#categories+1] = 'Film d\'animazione ' .. adj
if anno then
categories[#categories+1] = 'Film ' .. adj .. ' del ' .. anno
end
end
elseif table_name == 'paese_webserie' then
adj = get_adj(name_value, 'fp')
if adj then
categories[#categories+1] = 'Webserie ' .. adj
end
elseif table_name == 'paese_film_TV' then
adj = get_adj(name_value, 'mp')
if adj then
categories[#categories+1] = 'Film d\'animazione ' .. adj .. ' per la televisione'
end
elseif table_name == 'paese_fumetto' then
if name_value == 'Belgio' or name_value == 'Francia' then
categories[#categories+1] = 'Fumetti franco-belgi'
else
adj = get_adj(name_value, 'mp')
if adj and adj ~= 'giapponesi' and
adj ~= 'cinesi' and adj ~= 'coreani' then
categories[#categories+1] = 'Fumetti ' .. adj
end
end
elseif table_name == 'etichetta_sottotipo' or table_name == 'editore_sottotipo' then
categories[#categories+1] = get_category(args.sottotipo .. ' ' .. name_value, table_name)
else
local category = get_category(name_value, table_name)
if category then
categories[#categories+1] = category
end
end
else
break
end
index = index + 1
end
end
return categories
Riga 293 ⟶ 247:
-- Categorizzazione per anno delle opere previste
elseif args.tipo and tipo ~= nil and args['data inizio'] then
local anno = tonumberget_year(args['data inizio']:match) or get_year(args['%d%d%d%ddata fine')])
local anno
if args['data inizio'] then
anno = tonumber(args['data inizio']:match('%d%d%d%d'))
end
if anno == nil and args['data fine'] then
anno = tonumber(args['data fine']:match('%d%d%d%d'))
end
-- Categoria di errore quando data inizio/data fine sono compilati
-- ma non si rilevano le quattro cifre dell'anno in entrambi