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

Contenuto cancellato Contenuto aggiunto
+
+
Riga 3:
le funzioni di categorizzazione automatica
]]
 
require('Modulo:No globals')
 
local cfg = mw.loadData("Modulo:Fumetto e animazione/Configurazione/sandbox")
Riga 190 ⟶ 192:
elseif self.media.tipo == 'fumetto' and self.media.sottotipo then
self
:_addCategoriesBy('etichetta_sottotipo', nil, self._prependSubtype_substituteParameter)
:_addCategoriesBy('etichetta')
:_addCategoriesBy('editore_sottotipo', nil, self._prependSubtype_substituteParameter)
:_addCategoriesBy('editore')
:_addCategoriesBy('paese', 'mp', self._categorizeComicByCountry)
Riga 384 ⟶ 386:
end
 
-- AnteponePopola il sottotipo delll'operaargomento anumerato in una stringa col sottotipo dell'opera
function CategoryManager:_prependSubtype_substituteParameter(valuemsg)
return mw.message.newRawMessage(msg, self.media.sottotipo .. ' ' .. value):plain()
end
 
Riga 437 ⟶ 439:
table.sort(keys)
for _, key in ipairs(keys) do
local result, values = {}, {}
local value = cfg[table_name][key]
reverse_alias[key] = reverse_alias[key] or {}
local pre_table_name
for _, str in ipairs(type(value) == 'string' and { value } or value) do
if table_name == 'editore_sottotipo' or table_name == 'etichetta_sottotipo' then
pre_table_name = cfg.sottotipo.fumetto
elseif table_name == 'rete' then
pre_table_name = cfg.sottotipo.cartone
end
if pre_table_name then
for _, subtype in pairs(pre_table_name) do
local valuemsg = cfg[table_name][key]
table.insert(values, mw.message.newRawMessage(msg, subtype):plain())
end
elseif type(cfg[table_name][key]) == 'string' then
values = { cfg[table_name][key] }
else
values = cfg[table_name][key]
end
for _, str in ipairs(values) do
if table_name ~= 'genere_wikilink' then
str = string.format('[[:Categoria:%s%s]]', pre_str, str)
local pre_str = table_name == 'rete' and 'Serie televisive ' or ''
str = string.format('[[:Categoria:%s%s]]', pre_str, str)
end
table.insert(result, str)