« Module:Amiibo » : différence entre les versions

De Pikmin FR
added new alterna & side order amiibo
fr>Fxfxfx0
mAucun résumé des modifications
Ligne 1 : Ligne 1 :
local p = {}
local p = {}
-- Mapping table for English to French names
local amiiboFrenchNames = {
    ["Inkling Girl (Splatoon)"] = "Fille Inkling",
    ["Inkling Girl (Lime Green)"] = "Fille Inkling (recoloration)",
    ["Inkling Girl (recolor)"] = "Fille Inkling (recoloration)",
    ["Inkling Girl"] = "Fille Inkling",
    ["Inkling Boy (Splatoon)"] = "Garçon Inkling",
    ["Inkling Boy (Purple)"] = "Garçon Inkling (recoloration)",
    ["Inkling Boy (recolor)"] = "Garçon Inkling (recoloration)",
    ["Inkling Boy"] = "Garçon Inkling",
    ["Inkling Squid (Splatoon)"] = "Calamar Inkling",
    ["Inkling Squid (Orange)"] = "Calamar Inkling (recoloration)",
    ["Inkling Squid (recolor)"] = "Calamar Inkling (recoloration)",
    ["Inkling Squid"] = "Calamar Inkling",
    ["Callie"] = "Ayo",
    ["Marie"] = "Oly",
    ["Inkling Girl (Splatoon 2)"] = "Fille Inkling (Splatoon 2)",
    ["Inkling Girl 2"] = "Fille Inkling (Splatoon 2)",
    ["Inkling Boy (Splatoon 2)"] = "Garçon Inkling (Splatoon 2)",
    ["Inkling Boy 2"] = "Garçon Inkling (Splatoon 2)",
    ["Inkling Squid (Splatoon 2)"] = "Calamar Inkling (Splatoon 2)",
    ["Inkling Squid 2"] = "Calamar Inkling (Splatoon 2)",
    ["Octoling Girl"] = "Fille Octaling",
    ["Octoling Boy"] = "Garçon Octaling",
    ["Octoling Octopus"] = "Poulpe Octaling",
    ["Marina"] = "Coralie",
    ["Pearl"] = "Perle",
    ["Inkling (Yellow)"] = "Inkling (jaune)",
    ["Octoling (Blue)"] = "Octaling (bleu)",
    ["Smallfry"] = "Salmioche",
    ["Shiver"] = "Pasquale",
    ["Frye"] = "Angie",
    ["Big Man"] = "Raimi",
    ["Callie (Alterna)"] = "Ayo (Alterna)",
    ["Marie (Alterna)"] = "Oly (Alterna)",
    ["Pearl (Side Order)"] = "Perle (Tour de l'Ordre)",
    ["Marina (Side Order)"] = "Coralie (Tour de l'Ordre)",
    ["Inkling Girl (Super Smash Bros. Ultimate)"] = "Inkling (Super Smash Bros. Ultimate)"
}
-- Main function
p.main = function(frame)
p.main = function(frame)
     local args = frame:getParent().args
     local args = frame:getParent().args
Ligne 6 : Ligne 48 :
     local section = args['section'] or amiiboName
     local section = args['section'] or amiiboName
     local text = args['text'] or nil
     local text = args['text'] or nil
     -- Get the file extention; if unspecified or empty, use png.
     -- Get the file extension; if unspecified or empty, use png.
     local ext = (args['ext'] or '') == '' and 'png' or string.lower(args['ext'])
     local ext = (args['ext'] or '') == '' and 'png' or string.lower(args['ext'])


     -- Mapping table for amiibo name patterns to image file names. Order doesn't matter.
     -- Mapping table for amiibo name patterns to image file names and display text.
    -- Define 'text' if the display text after the icon is different to the amiibo's name.
     local amiiboMap = {
     local amiiboMap = {
    -- Splatoon 1
        -- Splatoon 1
         {pattern = "Inkling Girl (Splatoon)", imageName = "S_amiibo_Inkling Girl", text = "Inkling Girl (''Splatoon'')"},
         {pattern = "Inkling Girl (Splatoon)", imageName = "S_amiibo_Inkling Girl", text = "Fille Inkling (Splatoon)"},
         {pattern = "Inkling Girl (Lime Green)", imageName = "S_amiibo_Inkling Girl (Lime Green)", text = "Inkling Girl (Lime Green)"},
         {pattern = "Inkling Girl (Lime Green)", imageName = "S_amiibo_Inkling Girl (Lime Green)", text = "Fille Inkling (vert clair)"},
         {pattern = "Inkling Girl (recolor)", imageName = "S_amiibo_Inkling Girl (Lime Green)", text = "Inkling Girl (Lime Green)"},
         {pattern = "Inkling Girl (recolor)", imageName = "S_amiibo_Inkling Girl (Lime Green)", text = "Fille Inkling (vert clair)"},
         {pattern = "Inkling Girl", imageName = "S_amiibo_Inkling Girl", text = "Inkling Girl (''Splatoon'')"},
         {pattern = "Inkling Girl", imageName = "S_amiibo_Inkling Girl", text = "Fille Inkling (Splatoon)"},
         {pattern = "Inkling Boy (Splatoon)", imageName = "S_amiibo_Inkling Boy", text = "Inkling Boy (''Splatoon'')"},
         {pattern = "Inkling Boy (Splatoon)", imageName = "S_amiibo_Inkling Boy", text = "Garçon Inkling (Splatoon)"},
         {pattern = "Inkling Boy (Purple)", imageName = "S_amiibo_Inkling Boy (Purple)", text = "Inkling Boy (Purple)"},
         {pattern = "Inkling Boy (Purple)", imageName = "S_amiibo_Inkling Boy (Purple)", text = "Garçon Inkling (violet)"},
         {pattern = "Inkling Boy (recolor)", imageName = "S_amiibo_Inkling Boy (Purple)", text = "Inkling Boy (Purple)"},
         {pattern = "Inkling Boy (recolor)", imageName = "S_amiibo_Inkling Boy (Purple)", text = "Garçon Inkling (violet)"},
         {pattern = "Inkling Boy", imageName = "S_amiibo_Inkling Boy", text = "Inkling Boy (''Splatoon'')"},
         {pattern = "Inkling Boy", imageName = "S_amiibo_Inkling Boy", text = "Garçon Inkling (Splatoon)"},
         {pattern = "Inkling Squid (Splatoon)", imageName = "S_amiibo_Inkling Squid", text = "Inkling Squid (''Splatoon'')"},
         {pattern = "Inkling Squid (Splatoon)", imageName = "S_amiibo_Inkling Squid", text = "Calamar Inkling (Splatoon)"},
         {pattern = "Inkling Squid (Orange)", imageName = "S_amiibo_Inkling Squid (Orange)", text = "Inkling Squid (Orange)"},
         {pattern = "Inkling Squid (Orange)", imageName = "S_amiibo_Inkling Squid (Orange)", text = "Calamar Inkling (orange)"},
         {pattern = "Inkling Squid (recolor)", imageName = "S_amiibo_Inkling Squid (Orange)", text = "Inkling Squid (Orange)"},
         {pattern = "Inkling Squid (recolor)", imageName = "S_amiibo_Inkling Squid (Orange)", text = "Calamar Inkling (orange)"},
         {pattern = "Inkling Squid", imageName = "S_amiibo_Inkling Squid", text = "Inkling Squid (''Splatoon'')"},
         {pattern = "Inkling Squid", imageName = "S_amiibo_Inkling Squid", text = "Calamar Inkling (Splatoon)"},
         {pattern = "Callie", imageName = "S_amiibo_Callie"},
         {pattern = "Callie", imageName = "S_amiibo_Callie", text = "Ayo"},
         {pattern = "Marie", imageName = "S_amiibo_Marie"},
         {pattern = "Marie", imageName = "S_amiibo_Marie", text = "Oly"},
         -- Splatoon 2
         -- Splatoon 2
         {pattern = "Inkling Girl (Splatoon 2)", imageName = "S2_amiibo_Inkling Girl", text = "Inkling Girl (''Splatoon 2'')"},
         {pattern = "Inkling Girl (Splatoon 2)", imageName = "S2_amiibo_Inkling Girl", text = "Fille Inkling (Splatoon 2)"},
         {pattern = "Inkling Girl 2", imageName = "S2_amiibo_Inkling Girl", text = "Inkling Girl (''Splatoon 2'')"},
         {pattern = "Inkling Girl 2", imageName = "S2_amiibo_Inkling Girl", text = "Fille Inkling (Splatoon 2)"},
         {pattern = "Inkling Boy (Splatoon 2)", imageName = "S2_amiibo_Inkling Boy", text = "Inkling Boy (''Splatoon 2'')"},
         {pattern = "Inkling Boy (Splatoon 2)", imageName = "S2_amiibo_Inkling Boy", text = "Garçon Inkling (Splatoon 2)"},
         {pattern = "Inkling Boy 2", imageName = "S2_amiibo_Inkling Boy", text = "Inkling Boy (''Splatoon 2'')"},
         {pattern = "Inkling Boy 2", imageName = "S2_amiibo_Inkling Boy", text = "Garçon Inkling (Splatoon 2)"},
         {pattern = "Inkling Squid (Splatoon 2)", imageName = "S2_amiibo_Inkling Squid", text = "Inkling Squid (''Splatoon 2'')"},
         {pattern = "Inkling Squid (Splatoon 2)", imageName = "S2_amiibo_Inkling Squid", text = "Calamar Inkling (Splatoon 2)"},
         {pattern = "Inkling Squid 2", imageName = "S2_amiibo_Inkling Squid", text = "Inkling Squid (''Splatoon 2'')"},
         {pattern = "Inkling Squid 2", imageName = "S2_amiibo_Inkling Squid", text = "Calamar Inkling (Splatoon 2)"},
         {pattern = "Octoling Girl", imageName = "S2_amiibo_Octoling Girl transparent"},
         {pattern = "Octoling Girl", imageName = "S2_amiibo_Octoling Girl transparent", text = "Fille Octaling"},
         {pattern = "Octoling Boy", imageName = "S2_amiibo_Octoling Boy"},
         {pattern = "Octoling Boy", imageName = "S2_amiibo_Octoling Boy", text = "Garçon Octaling"},
         {pattern = "Octoling Octopus", imageName = "S2_amiibo_Octoling Octopus"},
         {pattern = "Octoling Octopus", imageName = "S2_amiibo_Octoling Octopus", text = "Poulpe Octaling"},
         {pattern = "Marina", imageName = "S2_amiibo_Marina"},
         {pattern = "Marina", imageName = "S2_amiibo_Marina", text = "Coralie"},
         {pattern = "Pearl", imageName = "S2_amiibo_Pearl"},
         {pattern = "Pearl", imageName = "S2_amiibo_Pearl", text = "Perle"},
         -- Splatoon 3
         -- Splatoon 3
         {pattern = "Inkling (Yellow)", imageName = "S3_amiibo_Inkling (Yellow)", text = "Inkling (''Splatoon 3'')"},
         {pattern = "Inkling (Yellow)", imageName = "S3_amiibo_Inkling (Yellow)", text = "Inkling (Splatoon 3)"},
         {pattern = "Octoling (Blue)", imageName = "S3_amiibo_Octoling (Blue)", text = "Octoling (''Splatoon 3'')"},
         {pattern = "Octoling (Blue)", imageName = "S3_amiibo_Octoling (Blue)", text = "Octoling (Splatoon 3)"},
         {pattern = "Smallfry", imageName = "S3_amiibo_Smallfry"},
         {pattern = "Smallfry", imageName = "S3_amiibo_Smallfry", text = "Salmioche"},
         {pattern = "Shiver", imageName = "S3_amiibo_Shiver"},
         {pattern = "Shiver", imageName = "S3_amiibo_Shiver", text = "Pasquale"},
         {pattern = "Frye", imageName = "S3_amiibo_Frye"},
         {pattern = "Frye", imageName = "S3_amiibo_Frye", text = "Angie"},
         {pattern = "Big Man", imageName = "S3_amiibo_Big Man"},
         {pattern = "Big Man", imageName = "S3_amiibo_Big Man", text = "Raimi"},
         {pattern = "Callie (Alterna)", imageName="S3_amiibo_Callie (Alterna)"},
         {pattern = "Callie (Alterna)", imageName="S3_amiibo_Callie (Alterna)", text = "Ayo (Alterna)"},
         {pattern = "Marie (Alterna)", imageName="S3_amiibo_Marie (Alterna)"},
         {pattern = "Marie (Alterna)", imageName="S3_amiibo_Marie (Alterna)", text = "Oly (Alterna)"},
         {pattern = "Pearl (Side Order)", imageName="S3_amiibo_Pearl (Side Order)"},
         {pattern = "Pearl (Side Order)", imageName="S3_amiibo_Pearl (Side Order)", text = "Perle (Tour de l'Ordre)"},
         {pattern = "Marina (Side Order)", imageName="S3_amiibo_Marina (Side Order)"},
         {pattern = "Marina (Side Order)", imageName="S3_amiibo_Marina (Side Order)", text = "Coralie (Tour de l'Ordre)"},
         -- Others
         -- Others
         {pattern = "Inkling Girl (Super Smash Bros. Ultimate)", imageName = "SSBU_amiibo_Inkling Girl", text = "Inkling Girl (''Super Smash Bros. Ultimate'')"}
         {pattern = "Inkling Girl (Super Smash Bros. Ultimate)", imageName = "SSBU_amiibo_Inkling Girl", text = "Inkling (Super Smash Bros. Ultimate)"}
     }
     }


     -- Default to amiiboName if not found
     -- Default values
     local imageName = amiiboName
     local imageName = amiiboName
     local amiiboText = nil
     local amiiboText = nil


     -- Iterate through the map to find the first matching pattern
     -- Find matching entry in amiiboMap
     for _, mapping in ipairs(amiiboMap) do
     for _, mapping in ipairs(amiiboMap) do
         if amiiboName == mapping.pattern then
         if amiiboName == mapping.pattern then
Ligne 66 : Ligne 107 :
         end
         end
     end
     end
    -- Determine the French section name
    local frenchSection = amiiboFrenchNames[amiiboName] or section


     -- Construct the image link
     -- Construct the image link
     local imageLink = string.format('[[File:%s.%s|%dx%dpx|%s|link=amiibo#%s]]',
     local imageLink = string.format('[[File:%s.%s|%dx%dpx|%s|link=amiibo#%s|%s]]',
                                     imageName, ext, size, size, amiiboName,
                                     imageName, ext, size, size, imageName,
                                     section)
                                     mw.text.encode(frenchSection), mw.text.encode(amiiboText or frenchSection))


    -- Create the <span> element for the image
     local span = mw.html.create('span')
     local span = mw.html.create('span')
     span:css('width', size .. 'px')
     span:css('width', size .. 'px')
Ligne 83 : Ligne 128 :
     -- Append additional text if not icononly
     -- Append additional text if not icononly
     if args[2] ~= 'icononly' and args[3] ~= 'icononly' then
     if args[2] ~= 'icononly' and args[3] ~= 'icononly' then
    text = text or amiiboText or amiiboName
         output = output .. '&#32;' .. '[[amiibo#' .. mw.text.encode(frenchSection) .. '|' .. mw.text.encode(amiiboText or frenchSection) .. ']]'
         output = output .. '&#32;' .. '[[amiibo#' .. section .. '|' .. text .. ']]'
     end
     end



Version du 18 septembre 2024 à 22:12

For use with Template:Amiibo.

Displays an inline amiibo icon with a text link.

Parameters

name Unnamed or named. The English name of the amiibo.
size Unnamed or named, optional. The numeric dimension in pixels for the maximum size of the icon. The default size is 24.
icononly Unnamed, optional. If present, the text label will be omitted.
section Named, optional. The section in the amiibo article to link to. If absent, name will be used.
text Named, optional. The link text. If absent, name will be used for all amiibo, except the Splatoon 2 series, who will exclude the numeral 2.
ext Named, optional. The file extension, e.g. jpg. Will default to png if unspecified or empty.

Examples

Markup

*{{amiibo|Inkling Boy}}
*{{amiibo|Inkling Boy (recolor)}}
*{{amiibo|Inkling Boy 2}}
*{{amiibo|Callie|48}}
*{{amiibo|Inkling Girl|icononly}}
*{{amiibo|Inkling Squid 2|48|icononly}}
*{{amiibo|Inkling Squid 2|text=The ''Splatoon 2'' series Inkling Squid}}
*{{amiibo|Inkling (Yellow)}}
*{{amiibo|Octoling (Blue)}}
*{{amiibo|Smallfry}}
*{{amiibo|Shiver}} {{amiibo|Frye}} {{amiibo|Big Man}}
*{{amiibo|Frye|ext=jpg}}

Output


local p = {}

-- Mapping table for English to French names
local amiiboFrenchNames = {
    ["Inkling Girl (Splatoon)"] = "Fille Inkling",
    ["Inkling Girl (Lime Green)"] = "Fille Inkling (recoloration)",
    ["Inkling Girl (recolor)"] = "Fille Inkling (recoloration)",
    ["Inkling Girl"] = "Fille Inkling",
    ["Inkling Boy (Splatoon)"] = "Garçon Inkling",
    ["Inkling Boy (Purple)"] = "Garçon Inkling (recoloration)",
    ["Inkling Boy (recolor)"] = "Garçon Inkling (recoloration)",
    ["Inkling Boy"] = "Garçon Inkling",
    ["Inkling Squid (Splatoon)"] = "Calamar Inkling",
    ["Inkling Squid (Orange)"] = "Calamar Inkling (recoloration)",
    ["Inkling Squid (recolor)"] = "Calamar Inkling (recoloration)",
    ["Inkling Squid"] = "Calamar Inkling",
    ["Callie"] = "Ayo",
    ["Marie"] = "Oly",
    ["Inkling Girl (Splatoon 2)"] = "Fille Inkling (Splatoon 2)",
    ["Inkling Girl 2"] = "Fille Inkling (Splatoon 2)",
    ["Inkling Boy (Splatoon 2)"] = "Garçon Inkling (Splatoon 2)",
    ["Inkling Boy 2"] = "Garçon Inkling (Splatoon 2)",
    ["Inkling Squid (Splatoon 2)"] = "Calamar Inkling (Splatoon 2)",
    ["Inkling Squid 2"] = "Calamar Inkling (Splatoon 2)",
    ["Octoling Girl"] = "Fille Octaling",
    ["Octoling Boy"] = "Garçon Octaling",
    ["Octoling Octopus"] = "Poulpe Octaling",
    ["Marina"] = "Coralie",
    ["Pearl"] = "Perle",
    ["Inkling (Yellow)"] = "Inkling (jaune)",
    ["Octoling (Blue)"] = "Octaling (bleu)",
    ["Smallfry"] = "Salmioche",
    ["Shiver"] = "Pasquale",
    ["Frye"] = "Angie",
    ["Big Man"] = "Raimi",
    ["Callie (Alterna)"] = "Ayo (Alterna)",
    ["Marie (Alterna)"] = "Oly (Alterna)",
    ["Pearl (Side Order)"] = "Perle (Tour de l'Ordre)",
    ["Marina (Side Order)"] = "Coralie (Tour de l'Ordre)",
    ["Inkling Girl (Super Smash Bros. Ultimate)"] = "Inkling (Super Smash Bros. Ultimate)"
}

-- Main function
p.main = function(frame)
    local args = frame:getParent().args
    local amiiboName = args['name'] or args[1] or ''
    local size = args['size'] or tonumber(args[2]) or 24
    local section = args['section'] or amiiboName
    local text = args['text'] or nil
    -- Get the file extension; if unspecified or empty, use png.
    local ext = (args['ext'] or '') == '' and 'png' or string.lower(args['ext'])

    -- Mapping table for amiibo name patterns to image file names and display text.
    local amiiboMap = {
        -- Splatoon 1
        {pattern = "Inkling Girl (Splatoon)", imageName = "S_amiibo_Inkling Girl", text = "Fille Inkling (Splatoon)"},
        {pattern = "Inkling Girl (Lime Green)", imageName = "S_amiibo_Inkling Girl (Lime Green)", text = "Fille Inkling (vert clair)"},
        {pattern = "Inkling Girl (recolor)", imageName = "S_amiibo_Inkling Girl (Lime Green)", text = "Fille Inkling (vert clair)"},
        {pattern = "Inkling Girl", imageName = "S_amiibo_Inkling Girl", text = "Fille Inkling (Splatoon)"},
        {pattern = "Inkling Boy (Splatoon)", imageName = "S_amiibo_Inkling Boy", text = "Garçon Inkling (Splatoon)"},
        {pattern = "Inkling Boy (Purple)", imageName = "S_amiibo_Inkling Boy (Purple)", text = "Garçon Inkling (violet)"},
        {pattern = "Inkling Boy (recolor)", imageName = "S_amiibo_Inkling Boy (Purple)", text = "Garçon Inkling (violet)"},
        {pattern = "Inkling Boy", imageName = "S_amiibo_Inkling Boy", text = "Garçon Inkling (Splatoon)"},
        {pattern = "Inkling Squid (Splatoon)", imageName = "S_amiibo_Inkling Squid", text = "Calamar Inkling (Splatoon)"},
        {pattern = "Inkling Squid (Orange)", imageName = "S_amiibo_Inkling Squid (Orange)", text = "Calamar Inkling (orange)"},
        {pattern = "Inkling Squid (recolor)", imageName = "S_amiibo_Inkling Squid (Orange)", text = "Calamar Inkling (orange)"},
        {pattern = "Inkling Squid", imageName = "S_amiibo_Inkling Squid", text = "Calamar Inkling (Splatoon)"},
        {pattern = "Callie", imageName = "S_amiibo_Callie", text = "Ayo"},
        {pattern = "Marie", imageName = "S_amiibo_Marie", text = "Oly"},
        -- Splatoon 2
        {pattern = "Inkling Girl (Splatoon 2)", imageName = "S2_amiibo_Inkling Girl", text = "Fille Inkling (Splatoon 2)"},
        {pattern = "Inkling Girl 2", imageName = "S2_amiibo_Inkling Girl", text = "Fille Inkling (Splatoon 2)"},
        {pattern = "Inkling Boy (Splatoon 2)", imageName = "S2_amiibo_Inkling Boy", text = "Garçon Inkling (Splatoon 2)"},
        {pattern = "Inkling Boy 2", imageName = "S2_amiibo_Inkling Boy", text = "Garçon Inkling (Splatoon 2)"},
        {pattern = "Inkling Squid (Splatoon 2)", imageName = "S2_amiibo_Inkling Squid", text = "Calamar Inkling (Splatoon 2)"},
        {pattern = "Inkling Squid 2", imageName = "S2_amiibo_Inkling Squid", text = "Calamar Inkling (Splatoon 2)"},
        {pattern = "Octoling Girl", imageName = "S2_amiibo_Octoling Girl transparent", text = "Fille Octaling"},
        {pattern = "Octoling Boy", imageName = "S2_amiibo_Octoling Boy", text = "Garçon Octaling"},
        {pattern = "Octoling Octopus", imageName = "S2_amiibo_Octoling Octopus", text = "Poulpe Octaling"},
        {pattern = "Marina", imageName = "S2_amiibo_Marina", text = "Coralie"},
        {pattern = "Pearl", imageName = "S2_amiibo_Pearl", text = "Perle"},
        -- Splatoon 3
        {pattern = "Inkling (Yellow)", imageName = "S3_amiibo_Inkling (Yellow)", text = "Inkling (Splatoon 3)"},
        {pattern = "Octoling (Blue)", imageName = "S3_amiibo_Octoling (Blue)", text = "Octoling (Splatoon 3)"},
        {pattern = "Smallfry", imageName = "S3_amiibo_Smallfry", text = "Salmioche"},
        {pattern = "Shiver", imageName = "S3_amiibo_Shiver", text = "Pasquale"},
        {pattern = "Frye", imageName = "S3_amiibo_Frye", text = "Angie"},
        {pattern = "Big Man", imageName = "S3_amiibo_Big Man", text = "Raimi"},
        {pattern = "Callie (Alterna)", imageName="S3_amiibo_Callie (Alterna)", text = "Ayo (Alterna)"},
        {pattern = "Marie (Alterna)", imageName="S3_amiibo_Marie (Alterna)", text = "Oly (Alterna)"},
        {pattern = "Pearl (Side Order)", imageName="S3_amiibo_Pearl (Side Order)", text = "Perle (Tour de l'Ordre)"},
        {pattern = "Marina (Side Order)", imageName="S3_amiibo_Marina (Side Order)", text = "Coralie (Tour de l'Ordre)"},
        -- Others
        {pattern = "Inkling Girl (Super Smash Bros. Ultimate)", imageName = "SSBU_amiibo_Inkling Girl", text = "Inkling (Super Smash Bros. Ultimate)"}
    }

    -- Default values
    local imageName = amiiboName
    local amiiboText = nil

    -- Find matching entry in amiiboMap
    for _, mapping in ipairs(amiiboMap) do
        if amiiboName == mapping.pattern then
            imageName = mapping.imageName
            amiiboText = mapping.text
            break
        end
    end

    -- Determine the French section name
    local frenchSection = amiiboFrenchNames[amiiboName] or section

    -- Construct the image link
    local imageLink = string.format('[[File:%s.%s|%dx%dpx|%s|link=amiibo#%s|%s]]',
                                    imageName, ext, size, size, imageName,
                                    mw.text.encode(frenchSection), mw.text.encode(amiiboText or frenchSection))

    -- Create the <span> element for the image
    local span = mw.html.create('span')
    span:css('width', size .. 'px')
    span:css('height', size .. 'px')
    span:css('text-align', 'center')
    span:css('display', 'inline-block')
    span:wikitext(imageLink)
    
    local output = tostring(span)

    -- Append additional text if not icononly
    if args[2] ~= 'icononly' and args[3] ~= 'icononly' then
        output = output .. '&#32;' .. '[[amiibo#' .. mw.text.encode(frenchSection) .. '|' .. mw.text.encode(amiiboText or frenchSection) .. ']]'
    end

    return output
end

return p