Modulo:Fumetto e animazione/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m + |
riordino |
||
Riga 46:
end
--
local function delink(value)
local pattern
Riga 87:
self.sottotipo = args.sottotipo
self.name = self:_getName()
self.alias = self:
return self
Riga 102:
end
-- Ottiene
function Media:
return self:_getValue('alias_tipo', 'alias_sottotipo')
end
-- Ottiene il nome più preciso del medium per le categorie
function Media:_getName()
return self:_getValue('tipo', 'sottotipo')
end
-- Cerca il nome o l'alias del medium nella configurazione
function Media:_getValue(key_tipo, key_sottotipo)
local ret = cfg[key_sottotipo][self.tipo] and
cfg[key_sottotipo][self.tipo][self.sottotipo] or
Riga 129 ⟶ 137:
self.tables_matched = {}
self:
return self
Riga 137 ⟶ 145:
function CategoryManager:listCategories()
return table.concat(self.categories)
end
-- Formatta e aggiunge una categoria
function CategoryManager:_addCategory(category)
table.insert(self.categories, string.format('[[Categoria:%s]]', category))
return self
end
-- Aggiunge categorie per una lista di valori
function CategoryManager:_addCategoriesBy(table_name, gender, callback)
if self:_isCategoryRedundant(table_name) == false then
local base_name = table_name:match('[^_]+')
for value in extract_values(self.args, base_name) do
if table_name == 'paese' then
self:_getCategoryByCountry(value, gender, callback)
else
if callback then value = callback(value) end
local category = self:_getCategory(value, table_name)
if category then
self.tables_matched[table_name] = true
self:_addCategory(category)
end
end
end
end
return self
end
-- Categorizza un fumetto per Paese
function CategoryManager:_categorizeComicByCountry(adj)
if adj == 'giapponesi' or adj == 'cinesi' or adj == 'coreani' then
return
elseif adj == 'belgi' or adj == 'francesi' then
adj = 'franco-belgi'
end
self:_addCategory('Fumetti ' .. adj)
end
-- Categorizza una serie direct-to-video per Paese
function CategoryManager:_categorizeDTVFilmByCountry(adj)
self:_addCategory("Film d'animazione " .. adj)
if self.year then
self:_addCategory(string.format('Film %s del %s', adj, self.year))
end
end
-- Categorizza un film televisivo per Paese
function CategoryManager:_categorizeTVFilmByCountry(adj)
self:_addCategory(string.format("Film d'animazione %s per la televisione", adj))
end
-- Categorizza una serie TV per Paese
function CategoryManager:_categorizeTVSeriesByCountry(adj)
if adj ~= 'giapponesi' or self.args['paese 2'] then
self:_addCategory("Serie televisive d'animazione " .. adj)
end
end
-- Categorizza una webserie per Paese
function CategoryManager:_categorizeWebseriesByCountry(adj)
self:_addCategory('Webserie ' .. adj)
end
-- Avvia la categorizzazione automatica dell'opera
function CategoryManager:
if (self.args['data inizio'] or self.args['data fine']) and not self.year then
self:_addCategory(error_category)
Riga 159 ⟶ 228:
elseif self.media.name == "film d'animazione per la televisione" then
self:_addCategoriesBy('paese', 'mp', self['_categorizeTVFilmByCountry'])
elseif self.media.tipo == 'manga' then
self
Riga 183 ⟶ 235:
elseif self.media:inArray('manhua', 'manhwa') then
self:_addCategoriesBy('editore')
elseif self.media.
self
:_addCategory(self.media.tipo)
:_addCategory('Romanzi in giapponese')
:_addCategoriesBy('etichetta')
:_addCategoriesBy('editore')
Riga 203 ⟶ 257:
:_addCategoriesBy('editore')
:_addCategoriesBy('paese', 'mp', self['_categorizeComicByCountry'])
end
if self.media:inArray('anime', 'cartone') then
local broadcaster
if self.media.alias == 'serie televisive' then
local network = self.args['rete 1'] or self.args.rete
broadcaster = self:_getCategory(network, 'rete')
elseif self.media.alias == 'webserie' then
local platform = self.args['streaming 1'] or self.args.streaming
broadcaster = self:_getCategory(platform, 'streaming')
end
if broadcaster then
self:_addCategory(self.media.alias .. broadcaster)
end
self:_addCategoriesBy('studio')
end
-- categorizzazione per tipo delle opere non suddivise per anno
if self.media:inArray('manhua', 'manhwa', '
self:_addCategory(self.media.name)
-- categorizzazione
elseif self.year and self.media.sottotipo ~= 'film direct-to-video' then
local media =
self.media.alias or self.media.name self:_addCategory(string.format('%s del %s', media, self.year))
end
end
Riga 257 ⟶ 289:
key = cfg['alias_' .. table_name] and cfg['alias_' .. table_name][key] or key
return cfg[table_name][key]
end
function CategoryManager:_getCategoryByCountry(value, gender, callback)
local adjective = self:_getCountryAdjective(value, gender)
if adjective then
return callback(adjective)
end
end
Riga 267 ⟶ 306:
})
if success then return result end
end
Riga 283 ⟶ 315:
end
-- Verifica che non sia già stata aggiunta una sottocategoria
function CategoryManager:
if cfg.sottocategorie[table_name] then
for _, value in ipairs(cfg.sottocategorie[table_name]) do
if self.tables_matched[value] then
return true
end
end
end
return false
end
|