Module:Infobox

local infobox = {} local function ucfirst(name) return string.gsub(name, "^%l", string.upper) end function infobox.icon(frame) local args = frame:getParent.args local name = string.lower(args[1]) local type = args[2] or args["Icon Type"] local size = args.size or "18" local link = args.link or args[1] or "" local text = args.text or "" if not name then return "" end name = string.gsub(string.gsub(name, "ū", "u"), "ō", "o") -- Fix macrons if type == "gender" then return string.format("", name, size) end if type == "Astrological Sign" then return string.format("", name, size) end if type == "Ninja rank" then if name == "genin" then return string.format("", size, link, text) end if name == "chunin" then return string.format("", size, link, text) end if name == "jonin" then return string.format("", size, link, text) end end -- Load the table of icons local icons = mw.loadData('Module:Infobox/icons') if type == "Kekkei Genkai" or type == "Nature" then name = string.gsub(name, " release$", "") if icons[name] == nil then local n = "Nature Icon "..mw.text.split(ucfirst(name), " ")[1]..".svg" if mw.title.new("File:"..n).exists then return (                   string.format("", n, size, link, text) ..                    "}}"                ) end else return string.format("%spx|link=%s|%s", icons[name], size, link, text) end end if type == "Ninja clan" then name = string.gsub(name, " clan$", "") if icons[name] == nil then local n = mw.text.split(ucfirst(name), " ")[1].." Symbol.svg" if mw.title.new("File:"..n).exists then return (                   string.format("", n, size, link, text) ..                    "}}"                ) end else return string.format("%spx|link=%s|%s", icons[name], size, link, text) end end if type == "Ninja loyalty" or type == "Team" then -- For Loyalty name = string.gsub(name, "^land of ", "") name = string.gsub(name, "^land of the ", "") if icons[name] == nil then local n = args[1].." Symbol.svg" if mw.title.new("File:"..n).exists then return (                   string.format("", n, size, link, text) ..                    "}}"                ) end else return string.format("%spx|link=%s|%s", icons[name], size, link, text) end end if icons[name] ~= nil then return string.format("%spx|link=%s|%s", icons[name], size, link, text) end

return "" end return infobox