79 548
contributi
(First bunch of data updates for the first DLC *** sovrascritto il testo esistente ***) |
(Updating alt forms links to point to specific subpages *** sovrascritto il testo esistente ***) |
||
local tab = require('Modulo:Wikilib/tables') -- luacheck: no unused
--[[
-- Creates link to alternative forms in list pointing to target instead of▼
Creates the link for an alternative form. There are two general
kinds of link: those pointing to the specific subpage of the Pokémon,
and those pointing to general pages (eg: "Forma di Alola").
local makeTargetedLink = function(linkstr, index, target, list, abbrs)▼
This function handles boths, depending on the arguments.
This function also handles empty form name, yielding no link at all
for _, poke in pairs(list) do▼
(an empty string).
t[poke][index] = table.map(t[poke].names, function(formName, formAbbr)▼
if abbrs and (formAbbr == 'base' or table.search(abbrs, formAbbr)) then▼
Arguments:
return formName == ''▼
- black: a boolean value. If true returns black links, otherwise normal
- formName: name of the specific form
- poke: base name of the Pokémon
anchor = t[poke].anchor or string.fu(poke),▼
- general: an optional string argument. If given, the function assumes
formName = formName▼
the link target should be the general page whose title is given by
})▼
the value of this parameter (eg: for a Megaevoluzione, this
parameter should be "Megaevoluzione")
--]]
local function makeSingleLink(black, formName, poke, general)
return ""
end
local target
if general then
target = table.concat{general, "#", t[poke].anchor or string.fu(poke)}
else
target = table.concat{string.fu(poke), "/Forme"}
end
black = black and " black-text" or "",
target = target
})
end
--[[
▲
the specific subpage of the Pokémon. This function modifies links only
for a given list of abbrs, and doesn't change other links.
Arguments:
- black: a boolean value. Is true adds blacklinks, otherwise normal
- target: the target page name
- list: a list of keys to which add the links for this target
- abbrs: the list of abbrs to modify
--]]
local index = black and 'blacklinks' or 'links'
return makeSingleLink(black, formName, name, target)
else
return t[
end
end)
-- Creates links to alternative forms
local function makeLinks
▲ and '<div class="small-text black-text">[[Differenze di forma#${anchor}|${formName}]]</div>'
local index = black and 'blacklinks' or 'links'
-- Removing support tables since we don't want to operate on them
local stdLinks = table.filter(t, function(_, key)
return not table.search({'mega', 'megaxy', 'archeo', 'alola', 'galar',
end)
--
for name, poke in pairs(stdLinks) do
poke[index] = table.map(poke.names, function(formName)
return
--
▲ formName = formName
end)
end
--
makeTargetedLink(
makeTargetedLink(
makeTargetedLink(
makeTargetedLink(
makeTargetedLink(
end
t.grimer.anchor = 'Grimer e Muk'
t.zigzagoon.anchor = 'Zigzagoon e Linoone'
-- t.wormadam.anchor = 'Burmy e Wormadam'
-- t.tornadus.anchor = 'Forze della Natura'
-- t.pumpkaboo.anchor = 'Pumpkaboo e Gourgeist'
-- Alternative forms' links
|