Module:PlayerStickers

local util_args = require('Module:ArgsUtil') local util_cargo = require("Module:CargoUtil") local util_esports = require("Module:EsportsUtil") local util_html = require("Module:HtmlUtil") local util_map = require('Module:MapUtil') local util_table = require("Module:TableUtil") local util_text = require("Module:TextUtil") local util_title = require("Module:TitleUtil") local util_vars = require("Module:VarsUtil") local i18n = require("Module:I18nUtil") local lang = mw.getLanguage('en') local m_team = require('Module:Team') util_cargo.setStoreNamespace('File')

local ROWS = { 'LinkDisplay', 'Team', 'Tournament', 'SortDateDisplay'}

local h = {} local p = {} function p.main(frame) local args = util_args.merge i18n.init('PlayerStickers') local data = h.formatDataFromArgs(args) util_cargo.store(data) return h.makeOutput(data) end

function h.formatDataFromArgs(args) local data = { _table = 'PlayerStickers', Link = args.playerlink or args.player, Team = args.team and m_team.teamlinkname(args.team), Tournament = util_title.target(args.tournament), LinkPlayerCaption = util_args.castAsBool(args.caption_link), SortDate = args.date, FileName = mw.title.getCurrentTitle.text, ImageType = 'Sticker', }	data.LinkDisplay = util_esports.playerLinked(data.Link) data.SortDateDisplay = args.date or i18n.print('noSortDate') return data end

function h.makeCaption(args) if args.tournament and args.team then return ('%s %s, %s'):format(			m_team.short(args.team),			util_esports.playerDisplay(args.playerlink or args.player),			args.tournament		) end if args.playerlink or args.player then return util_esports.playerDisplay(args.playerlink or args.player) end return mw.title.getCurrentTitle.text:find('(.+?)%.') end

function h.makeOutput(data) local output = mw.html.create('table') :addClass('wikitable') util_html.printVerticalData(output, data, ROWS) return output end

return p