Module:Infobox
Jump to navigation
Jump to search
Lua methods used by Template:Infobox. Uses Lua methods from Module:Infobox/parsing and Module:Util.
Edit this documentation on Module:Infobox/doc.
Methods
base_tab
space_age_tab
local p = {}
function p.item_parsing(frame)
local args = frame.args
if args[1] == "?" then
return args[1] -- same as old template, likely not needed
end
local ret = ""
local items = p._split(args[1], "+")
for _, item in ipairs(items) do
local icon_args = p._split(item, ",")
icon_args[2] = icon_args[2] or ""
ret = ret .. frame:expandTemplate{title = 'icon/special', args = icon_args}
end
return ret
end
-- @param inputstr string A string to be split
-- @param separator string The separator
-- @return string[] @The separated strings, without the separator
function p._split(inputstr, separator)
local result = {}
for str in string.gmatch(inputstr, "([^"..separator.."]+)") do
table.insert(result, mw.text.trim(str))
end
return result
end
return p