Difference between revisions of "Module:Infobox"
Jump to navigation
Jump to search
m (Guess I can just do this on Template:Block and Template:Item) |
(test) |
||
| Line 12: | Line 12: | ||
args = f:getParent().args | args = f:getParent().args | ||
end | end | ||
return f:expandTemplate{ title='Infobox', args = | |||
local title = args["title"] or "" | |||
local image = args["image"] or "" | |||
local invimage = args["invimage"] or "" | |||
local invimage2 = args["invimage2"] or "" | |||
local invimage3 = args["invimage3"] or "" | |||
local invimage4 = args["invimage4"] or "" | |||
local type = args["type"] or "Item" | |||
local tool = args["tool"] or "None" | |||
local tool2 = args["tool2"] or "" | |||
local armorrating = args["armorrating"] or "" | |||
local armortoughness = args["armortoughness"] or "" | |||
local damage = args["damage"] or "" | |||
local durability = args["durability"] or "" | |||
local mininglevel = args["mininglevel"] or "" | |||
local stackable = args["stackable"] or "" | |||
local flammable = args["flammable"] or "None" | |||
local danger = args["danger"] or "" | |||
local protection = args["protection"] or "" | |||
local storageslots = args["storageslots"] or "" | |||
local lstorage = args["lstorage"] or "" | |||
local upgrades = args["upgrades"] or "" | |||
local prevtier = args["prevtier"] or "" | |||
local nexttier = args["nexttier"] or "" | |||
local maxeu = args["maxeu"] or "" | |||
local eu_use = args["eu_use"] or "" | |||
local eu_use2 = args["eu_use2"] or "" | |||
local storage = args["storage"] or "" | |||
local eu_produce = args["eu_produce"] or "" | |||
local maxout = args["maxout"] or "" | |||
local maxhu = args["maxhu"] or "" | |||
local hu_use = args["hu_use"] or "" | |||
local hu_produce = args["hu_produce"] or "" | |||
local maxku = args["maxku"] or "" | |||
local ku_use = args["ku_use"] or "" | |||
local ku_use2 = args["ku_use2"] or "" | |||
local ku_produce = args["ku_produce"] or "" | |||
local optime = args["optime"] or "" | |||
local uu = args["uu"] or args["uu_cost"] or "" | |||
local firstappearance = args["firstappearance"] or "" | |||
local lastappearance = args["lastappearance"] or "" | |||
local id = args["id"] or "" | |||
local fluidspeed = args["fluidspeed"] or "" | |||
local movespeed = args["movespeed"] or "" | |||
return f:expandTemplate{ title='Infobox', args = { title = title, image = image, invimage = invimage, invimage2 = invimage2, invimage3 = invimage3, invimage4 = invimage4, type = type, tool = tool, tool2 = tool2, armorrating = armorrating, armortoughness = armortoughness, damage = damage, durability = durability, mininglevel = mininglevel, stackable = stackable, flammable = flammable, danger = danger, protection = protection, storageslots = storageslots, lstorage = lstorage, upgrades = upgrades, prevtier = prevtier, nexttier = nexttier, maxeu = maxeu, eu_use = eu_use, eu_use2 = eu_use2, storage = storage, eu_produce = eu_produce, maxout = maxout, maxhu = maxhu, ku_use = ku_use, ku_use2 = ku_use2, ku_produce = ku_produce, optime = optime, uu = uu, firstappearance = firstappearance, lastappearance = lastappearance, id = id, fluidspeed = fluidspeed, movespeed = movespeed } } | |||
end | end | ||
return p | return p | ||
Revision as of 05:33, 5 February 2021
Work around for {{Block}} and {{Item}} needing to call {{Infobox}} and add categories (Category:Blocks and Category:Items receptively) to the pages calling them.
The above documentation is transcluded from Module:Infobox/doc. (edit | history)
local p = {}
function p.block( f )
if f == mw.getCurrentFrame() then
args = f:getParent().args
end
return f:expandTemplate{ title='Infobox', args = args }
end
function p.item( f )
if f == mw.getCurrentFrame() then
args = f:getParent().args
end
local title = args["title"] or ""
local image = args["image"] or ""
local invimage = args["invimage"] or ""
local invimage2 = args["invimage2"] or ""
local invimage3 = args["invimage3"] or ""
local invimage4 = args["invimage4"] or ""
local type = args["type"] or "Item"
local tool = args["tool"] or "None"
local tool2 = args["tool2"] or ""
local armorrating = args["armorrating"] or ""
local armortoughness = args["armortoughness"] or ""
local damage = args["damage"] or ""
local durability = args["durability"] or ""
local mininglevel = args["mininglevel"] or ""
local stackable = args["stackable"] or ""
local flammable = args["flammable"] or "None"
local danger = args["danger"] or ""
local protection = args["protection"] or ""
local storageslots = args["storageslots"] or ""
local lstorage = args["lstorage"] or ""
local upgrades = args["upgrades"] or ""
local prevtier = args["prevtier"] or ""
local nexttier = args["nexttier"] or ""
local maxeu = args["maxeu"] or ""
local eu_use = args["eu_use"] or ""
local eu_use2 = args["eu_use2"] or ""
local storage = args["storage"] or ""
local eu_produce = args["eu_produce"] or ""
local maxout = args["maxout"] or ""
local maxhu = args["maxhu"] or ""
local hu_use = args["hu_use"] or ""
local hu_produce = args["hu_produce"] or ""
local maxku = args["maxku"] or ""
local ku_use = args["ku_use"] or ""
local ku_use2 = args["ku_use2"] or ""
local ku_produce = args["ku_produce"] or ""
local optime = args["optime"] or ""
local uu = args["uu"] or args["uu_cost"] or ""
local firstappearance = args["firstappearance"] or ""
local lastappearance = args["lastappearance"] or ""
local id = args["id"] or ""
local fluidspeed = args["fluidspeed"] or ""
local movespeed = args["movespeed"] or ""
return f:expandTemplate{ title='Infobox', args = { title = title, image = image, invimage = invimage, invimage2 = invimage2, invimage3 = invimage3, invimage4 = invimage4, type = type, tool = tool, tool2 = tool2, armorrating = armorrating, armortoughness = armortoughness, damage = damage, durability = durability, mininglevel = mininglevel, stackable = stackable, flammable = flammable, danger = danger, protection = protection, storageslots = storageslots, lstorage = lstorage, upgrades = upgrades, prevtier = prevtier, nexttier = nexttier, maxeu = maxeu, eu_use = eu_use, eu_use2 = eu_use2, storage = storage, eu_produce = eu_produce, maxout = maxout, maxhu = maxhu, ku_use = ku_use, ku_use2 = ku_use2, ku_produce = ku_produce, optime = optime, uu = uu, firstappearance = firstappearance, lastappearance = lastappearance, id = id, fluidspeed = fluidspeed, movespeed = movespeed } }
end
return p