Module:Infobox Player: Difference between revisions
Appearance
added basic category support |
m fixed categories |
||
| Line 20: | Line 20: | ||
outArgs.rows = count | outArgs.rows = count | ||
outArgs.categories = 1 | |||
return infobox.infobox{ | return infobox.infobox{ | ||
getParent = function() return { args = outArgs } end | getParent = function() return { args = outArgs } end | ||
Revision as of 16:01, 21 June 2025
Documentation for this module may be created at Module:Infobox Player/doc
local infobox = require('Module:Infobox')
local p = {}
local function humanLabel(name)
return mw.ustring.gsub(mw.ustring.upper(mw.ustring.sub(name,1,1)) .. mw.ustring.sub(name,2), "%-", " ")
end
function p.infobox(frame)
local args = frame:getParent().args
local outArgs = { title = args.username, category1 = args.category1 }
local count = 0
for key, val in pairs(args) do
if key ~= 'username' and val and val ~= '' and key ~= 'category1' then
count = count + 1
outArgs['label'..count] = humanLabel(key)
outArgs['data' ..count] = val
end
end
outArgs.rows = count
outArgs.categories = 1
return infobox.infobox{
getParent = function() return { args = outArgs } end
}
end
return p