Documentation for this module may be created at Module:Infobox/Modpack/doc
local p = {}
g = require("Module:Common")
box = require("Module:Infobox")
-- returns MW code for a modpack infobox
-- function p.modpack(name, img, imgwidth, fullimage, caption, rows,
-- creator, version, mcversion, code, prevpack, nextpack, mods)
function p.modpack(args)
if not args then args = {} end
local l = ""
-- special handling for FTB as creator
cl = string.lower(args.creator or "")
if cl == "ftb" or cl == "ftbteam"
or cl == "ftb team" or cl == "the ftb team" then
args.creator = "The FTB Team"
end
-- special handling for launcher names
ll = string.lower(args.launcher or "")
if ll == "at" or ll == "atl"
or ll == "atlauncher" or ll == "at launcher" then
args.launcher = "ATLauncher"
elseif ll == "ftb" or ll == "ftblauncher"
or ll == "ftb launcher" or ll == "feedthebeast"
or ll == "feed the beast" or ll == "feed the beast launcher" then
args.launcher = "Feed The Beast Launcher"
end
if g.isGiven(args.creator) then
devstr = ""
for dev in string.gmatch(args.creator, "[^,;]+") do
devstr = devstr .. "[[Created by::" .. dev .. "]], "
end
l = l .. box.row("Creator", string.sub(devstr, 1, -3))
else
l = l .. box.row("Creator", "Unknown")
end
if g.isGiven(args.launcher) then
l = l .. box.row("Launcher", "[[Is on launcher::" .. args.launcher .. "]]")
else
l = l .. box.row("Launcher", "Unknown")
end
if g.isGiven(args.version) then
l = l .. box.row("Latest Version", "[[Version::" .. args.version .. "]]")
else
l = l .. box.row("Latest Version", "Unknown")
end
if g.isGiven(args.mcversion) then
l = l .. box.row("[[Minecraft]] Version", "[[Minecraft version::" .. args.mcversion .. "]]")
else
l = l .. box.row("[[Minecraft]] Version", "Unknown")
end
l = l .. box.condRow("Private Pack Code", args.code)
l = l .. box.condRow("Website", args.url)
l = l .. box.condRow("Changelog", args.changelog)
l = l .. box.condRow("Replaces", args.prevpack)
l = l .. box.condRow("Replaced by", args.nextpack)
l = l .. box.condRow("Mod count", args.modcount)
if g.isGiven(args.rows) then
l = l .. args.rows
end
args.rows = l
return box.infobox(args)
end
-- wrapper for modpack, can be called correctly from MW code
function p.main(frame)
return p.modpack(frame.args)
end
return p