Differenze tra le versioni di "Modulo:AltForms/data"

Fixed pokemoncentral/wiki-project#40 (spero)
m
(Fixed pokemoncentral/wiki-project#40 (spero))
local tab = require('Modulo:Wikilib/tables') -- luacheck: no unused
 
-- Crea iCreates link alle formeto alternative forms in list pointing to target instead of
-- pagina apposita e non "Differenze di forma"
local makeTargetedLink = function(linkstr, index, target, list)
linklinkstr = linklinkstr:gsub('Differenze di forma', 'Forma di Alola'target)
for _, poke in pairs(t.megalist) do
t[poke][index] = table.map(t[poke].names, function(formName)
return formName == ''
and ''
or string.interp(linklinkstr, {
anchor = t[poke].anchor or string.fu(poke),
formName = formName
})
end)
end
end
 
-- Creates links to alternative forms
local makeLinks = function(black)
local link = black
and '<div class="small-text black-text">[[Differenze di forma#${anchor}|<span style="color:#000">${formName}</span>]]</div>'
or '<div class="small-text">[[Differenze di forma#${anchor}|${formName}]]</div>'
local index = black and 'blacklinks' or 'links'
-- Si eliminano le table di supporto e i
-- Pokémon che non hanno i link standard
 
local stdLinks = table.filter(t, function(_, key)
return
 
-- Links standard
 
for name, poke in pairs(stdLinks) do
poke[index] = table.map(poke.names, function(formName)
end
 
-- Link of forms with a dedicated page instead of "Differenze di forma"
-- Link vuoti: mega, megaxy e archeo
makeTargetedLink(link, index, 'Megaevoluzione', table.merge(t.mega, t.megaxy))
 
makeTargetedLink(link, index, 'Archeorisveglio', t.archeo)
for _, poke in pairs(t.mega) do
makeTargetedLink(link, index, 'Forma di Alola', t.alola)
t[poke][index] = table.map(t[poke].names, function()
return ''
end)
end
for _, poke in pairs(t.megaxy) do
t[poke][index] = table.map(t[poke].names, function()
return ''
end)
end
for _, poke in pairs(t.archeo) do
t[poke][index] = table.map(t[poke].names, function()
return ''
end)
end
 
-- Link alle forme di alola, che puntano ad una
-- pagina apposita e non "Differenze di forma"
 
link = link:gsub('Differenze di forma', 'Forma di Alola')
for _, poke in pairs(t.alola) do
t[poke][index] = table.map(t[poke].names, function(formName)
return formName == ''
and ''
or string.interp(link, {
anchor = t[poke].anchor or string.fu(poke),
formName = formName
})
end)
end
end
 
G = 'Tipo Ghiaccio'}
t.minior.names = {R = 'Forma Nucleo', base = 'Forma Meteora'}
t.necrozma.names = {V = 'Necrozma Criniera del Vespro', A = '"Necrozma Ali dell\'Aurora'",
U = 'UltraNecrozma', base = ''}
for k, v in pairs(t.mega) do
local fu = string.fu(v)
t[v] = {}
t[v].names = {M = 'Mega' .. fu, base = fu''}
end
for k, v in pairs(t.megaxy) do
t[v] = {}
t[v].names = {MX = table.concat{'Mega', fu, ' X'},
MY = table.concat{'Mega', fu, ' Y'}, base = fu''}
end
for k, v in pairs(t.archeo) do
local fu = string.fu(v)
t[v] = {}
t[v].names = {A = 'ArcheoArcheorisveglio' .. fu, base = fu''}
end
for k, v in pairs(t.alola) do