Module:Attribute ID: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 20: Line 20:


function p._main(args)
function p._main(args)
if args[1] then
    if args[1] then
    local attribute = string.upper(args[1])
        local attribute = string.upper(args[1])
local pageName
        local pageName
    for key, value in pairs(attributedict) do
        for key, value in pairs(attributedict) do
        if string.match(attribute, key) then
            if string.match(attribute, key) then
output = attribute:gsub(key,value)
                output = attribute:gsub(key,value)
if output == "None" then
                if output == "None" then
pageName = "Null"
                    pageName = "Null"
else
                else
pageName = output
                    pageName = output
end
                end
            local formattedImage
                local formattedImage
 
                local formattedLink
            if args[3] == "text" then
                if args[2] == "text" then
                formattedImage = string.format('[[File:Attrib-%s.png|%s|link=%s|%s]]', output, args[2] or '20px', pageName, args['text'] or pageName)
                    formattedImage = string.format('[[File:Attrib-%s.png|%s|link=%s|%s]]','20px', pageName, args['text'] or pageName)
                local formattedLink = string.format('[[%s|%s]]', args['link'] or pageName, args['text'] or pageName)
                    formattedLink = string.format('[[%s|%s]]', args['link'] or pageName, args['text'] or pageName)
                return string.format('<span style="white-space: nowrap;">%s %s</span>', formattedImage, formattedLink)
                    return string.format('<span style="white-space: nowrap;">%s %s</span>', formattedImage, formattedLink)
            else
                else
                formattedImage = string.format('[[File:Attrib-%s.png|%s|link=%s|%s]]', output, args[2] or '36px', pageName, args['text'] or pageName)
                    if args[3] == "text" then
                return formattedImage
                        formattedImage = string.format('[[File:Attrib-%s.png|%s|link=%s|%s]]', output, args[2] or '20px', pageName, args['text'] or pageName)
                        formattedLink = string.format('[[%s|%s]]', args['link'] or pageName, args['text'] or pageName)
                        return string.format('<span style="white-space: nowrap;">%s %s</span>', formattedImage, formattedLink)
                    else
                        formattedImage = string.format('[[File:Attrib-%s.png|%s|link=%s|%s]]', output, args[2] or '36px', pageName, args['text'] or pageName)
                        return formattedImage
                    end
                end
             end
             end
         end
         end
     end
     end
end
end
end


return p
return p
704

edits

Navigation menu