Module:Rank

local getArgs = require('Module:Arguments').getArgs local loader = require('Module:Loader')

local string, table, yesno = loader.require('String', 'Table', 'Yesno')

local rankData, rankAliases = loader.loadData('Rank/Data', 'Rank/Aliases')

local p = {}

function p.rank(frame) local function wikitext(rank, index, lnk) return  .. text ..  end local args = getArgs(frame) local name = rankAliases[string.upper(args[1] or args.rank)] local rank = rankData[name] local size = args.size and args.size..'px' or nil local bracket = yesno(args.bracket) or yesno(args.br) local text = bracket and ('[%s]'):format(name) or name local ret = ('%s'):format(		rank.index,		rank.link,		string.wrapHtml(text, 'span', { class = 'mcui-text format-' .. rank.colorCode, style = { display = 'inline', ['flex-wrap'] = 'wrap', ['font-size'] = size }		})	)	return mw.getCurrentFrame:preprocess(ret) end

return p