Module:GenerateDescription/Team

From TwogPedia
Revision as of 12:43, 30 April 2024 by Couchor (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:GenerateDescription/Team/doc

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

local p = {}

function p.main(frame)
  local args = getArgs(frame)
  local currentTitle = mw.title.getCurrentTitle().text
  local currentTitleSplit = mw.text.split(currentTitle, '/')
  local game = currentTitleSplit[1]

  local div = mw.html.create('div')
  local org = args.org and (' is the ' .. game .. ' team of [[Companies/' .. args.org .. ']]') or ' a ' .. game .. ' team'
  local founded = args.founded and (' that was founded on ' .. args.founded ) or ''
  local region = args.region and ('They compete in the ' .. args.region .. ' region') or ''
  local roster = args.roster and ( args.region and (' and have a ' .. args.roster .. ' roster ' ) or ('They have a ' .. args.roster .. ' roster') ) or ''
  div:wikitext(mw.ext.displaytitle.get(currentTitle) .. org  .. founded .. '. ' .. region .. roster)

  return div
end

return p