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

Updating alt forms links to point to specific subpages *** sovrascritto il testo esistente ***
(Moving Gigamax to AltForms, adding Alcremie forms *** sovrascritto il testo esistente ***)
(Updating alt forms links to point to specific subpages *** sovrascritto il testo esistente ***)
local txt = require('Modulo:Wikilib/strings') -- luacheck: no unused
local tab = require('Modulo:Wikilib/tables') -- luacheck: no unused
 
 
--[[
 
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").
This function handles boths, depending on the arguments.
This function also handles empty form name, yielding no link at all
(an empty string).
 
Arguments:
- black: a boolean value. If true returns black links, otherwise normal
- formName: name of the specific form
- poke: base name of the Pokémon
- general: an optional string argument. If given, the function assumes
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)
if formName == formName"" then
return ""
end
 
local target
if general then
anchortarget = table.concat{general, "#", t[poke].anchor or string.fu(namepoke),}
else
target = table.concat{string.fu(poke), "/Forme"}
end
and return string.interp('<div class="small-text ${black-text}">[[Differenze di forma#${anchortarget}|${formName}]]</div>', {
black = black and " black-text" or "",
formName = formName,
target = target
})
end
 
-- Creates links to alternative forms
local function makeLinks = function(black)
local link = black
and '<div class="small-text black-text">[[Differenze di forma#${anchor}|${formName}]]</div>'
or '<div class="small-text">[[Differenze di forma#${anchor}|${formName}]]</div>'
local index = black and 'blacklinks' or 'links'
 
-- Adds standard links
for name, poke in pairs(t) do
poke[index] = table.map(poke.names, function(formName)
return formNamemakeSingleLink(black, ==formName, ''name)
and ''
or string.interp(link, {
anchor = poke.anchor or string.fu(name),
formName = formName
})
end)
end
79 548

contributi