La documentación para este módulo puede ser creada en Módulo:Apariciones/doc
local p = {}
function p.main(frame)
local arguments = ''
for k, v in ipairs(frame:getParent().args) do
v = trim(v)
local legend = nil
if string.find(v, '~') ~= nil then
legend = v:sub(v:find('~') + 1, v:len())
v = v:sub(1, v:find('~') - 1)
end
local modifier = string.match(v, '[\!\+]$')
if modifier ~= nil then
v = string.sub(v, 1, string.len(v) - 1)
end
local alternative = string.match(v, '\?$')
if modifier == nil then
if legend == nil then
modifier = ''
else
modifier = legend
end
elseif modifier == '!' then
modifier = 'Cameo'
elseif modifier == '+' then
modifier = 'Debut'
end
if alternative == nil then
arguments = arguments .. frame:expandTemplate{title = 'Aparición', args = { v, modifier }} .. '\n'
else
v = string.sub(v, 1, string.len(v) - 1) -- remove '?'
local image
local altname = v
if v == 'Grey' then
image = 'Grey transformada (aparición).png'
elseif v == 'Fana (Elfo)' or v == 'Fana (elfo)' or v == 'Fana' then
v = 'Fana (Elfo)'
altname = 'Fana'
image = 'Fana (Elfo) (aparición).png'
elseif v == 'Patry' then
altname = 'Licht'
elseif v == 'Fragil Tormenta' or v == 'Puli Angel' then
altname = v:sub(1, v:find(' ')) .. 'poseída'
image = v .. ' (elfo) (aparición).png'
elseif v == 'Kaiser Granvorka' then
altname = v:sub(1, v:find(' ')) .. 'poseído'
image = v .. ' (elfo) (aparición).png'
end
arguments = arguments .. frame:expandTemplate{title = 'Aparición', args = { v, modifier, altname, image }} .. '\n'
end
end
return arguments
end
function trim(s)
return s:match( "^%s*(.-)%s*$" )
end
return p