No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
local LinksWidget = require('Module:Infobox/Widget/Links') | local LinksWidget = require('Module:Infobox/Widget/Links') | ||
local ListWidget = require('Module:Infobox/Widget/List') | local ListWidget = require('Module:Infobox/Widget/List') | ||
local LocationWidget = require('Module:Infobox/Widget/Location') | |||
local RowWidget = require('Module:Infobox/Widget/Row') | |||
local Flags = require('Module:Flags') | local Flags = require('Module:Flags') | ||
Line 21: | Line 23: | ||
container:node(headerNode):node(Subheader.make('Team Information')) | container:node(headerNode):node(Subheader.make('Team Information')) | ||
if args. | if args.country then | ||
container:node(RowWidget.make('Location', LocationWidget.make(args.country, args.city, currentTitleSplit[1] .. '/Teams'))) | |||
end | end | ||
-- if args.location then | |||
-- local countryName = Flags.CountryName(args.location) | |||
-- local flag = Flags.icon(args.location, currentTitleSplit[1]) | |||
-- local location = mw.html.create('div') | |||
-- :addClass('ib-row') | |||
-- local link = ':Category:' .. currentTitleSplit[1] .. '/' .. countryName | |||
-- local locationName = mw.html.create('span') | |||
-- :wikitext('[[' .. link .. '|' .. countryName .. ']]') | |||
-- local name = mw.html.create('div') | |||
-- :addClass('ib-rowName') | |||
-- :wikitext('Location: ') | |||
-- local value = mw.html.create('div') | |||
-- :wikitext(flag) | |||
-- :node(locationName) | |||
-- container:node(location:node(name):node(value)) | |||
-- end | |||
if args.region then | if args.region then | ||
container:node(RowWidget.make('Region', LocationWidget.make(args.region, nil, currentTitleSplit[1] .. '/Teams'))) | |||
end | end | ||
-- if args.region then | |||
-- local countryName = Flags.CountryName(args.region) | |||
-- local flag = Flags.icon(args.region, currentTitleSplit[1]) | |||
-- local region = mw.html.create('div') | |||
-- :addClass('ib-row') | |||
-- local link = ':Category:' .. currentTitleSplit[1] .. '/' .. countryName | |||
-- local regionName = mw.html.create('span') | |||
-- :wikitext('[[' .. link .. '|' .. countryName .. ']]') | |||
-- local name = mw.html.create('div') | |||
-- :addClass('ib-rowName') | |||
-- :wikitext('Region: ') | |||
-- local value = mw.html.create('div') | |||
-- :wikitext(flag) | |||
-- :node(regionName) | |||
-- container:node(region:node(name):node(value)) | |||
-- end | |||
if args.founded then | if args.founded then | ||
container:node(RowWidget.make('Founded', args.founded)) | |||
end | end | ||
-- if args.founded then | |||
-- local founded = mw.html.create('div') | |||
-- :addClass('ib-row') | |||
-- local name = mw.html.create('div') | |||
-- :addClass('ib-rowName') | |||
-- :wikitext('Founded: ') | |||
-- local value = mw.html.create('div') | |||
-- :wikitext(args.founded) | |||
-- container:node(founded:node(name):node(value)) | |||
-- end | |||
if args.org then | if args.org then | ||
local org = mw.html.create('div') | container:node(RowWidget.make('Organization', args.org, frame)) | ||
end | |||
-- if args.org then | |||
-- local org = mw.html.create('div') | |||
-- :addClass('ib-row') | |||
-- local name = mw.html.create('div') | |||
-- :addClass('ib-rowName') | |||
-- :wikitext('Organization: ') | |||
-- local value = mw.html.create('div') | |||
-- local pageExists = frame:callParserFunction('#ifexist', args.org, 'yes', 'no' ) | |||
-- if ( pageExists == 'yes' ) then | |||
-- value:wikitext('<span>[[' .. args.org .. '|' .. args.org .. ']]</span>') | |||
-- else | |||
-- value:wikitext(args.org) | |||
-- end | |||
-- container:node(org:node(name):node(value)) | |||
end | -- end | ||
if args.sponsors then | if args.sponsors then | ||
container:node(RowWidget.make('Sponsors', ListWidget.make(args.sponsors))) | |||
end | end | ||
-- if args.sponsors then | |||
-- local sponsors = mw.html.create('div') | |||
-- :addClass('ib-row') | |||
-- local name = mw.html.create('div') | |||
-- :addClass('ib-rowName') | |||
-- :wikitext('Sponsors: ') | |||
-- local value = ListWidget.make(args.sponsors) | |||
-- container:node(sponsors:node(name):node(value)) | |||
-- end | |||
if args.coach then | if args.coach then | ||
local coach = mw.html.create('div') | container:node(RowWidget.make('Coach', args.coach, frame)) | ||
end | |||
-- if args.coach then | |||
-- local coach = mw.html.create('div') | |||
-- :addClass('ib-row') | |||
-- local name = mw.html.create('div') | |||
-- :addClass('ib-rowName') | |||
-- :wikitext('Coach: ') | |||
-- local value = mw.html.create('div') | |||
-- local pageExists = frame:callParserFunction('#ifexist', args.coach, 'yes', 'no' ) | |||
-- if ( pageExists == 'yes' ) then | |||
-- value:wikitext('<span>[[' .. args.coach .. '|' .. args.coach .. ']]</span>') | |||
-- else | |||
-- value:wikitext(args.coach) | |||
-- end | |||
-- container:node(coach:node(name):node(value)) | |||
-- end | |||
if args.manager then | |||
container:node(RowWidget.make('Manager', args.manager, frame)) | |||
end | end | ||
if args.manager then | -- if args.manager then | ||
-- local manager = mw.html.create('div') | |||
-- :addClass('ib-row') | |||
-- local name = mw.html.create('div') | |||
-- :addClass('ib-rowName') | |||
-- :wikitext('Manager: ') | |||
-- local value = mw.html.create('div') | |||
-- local pageExists = frame:callParserFunction('#ifexist', args.manager, 'yes', 'no' ) | |||
-- if ( pageExists == 'yes' ) then | |||
-- value:wikitext('<span>[[' .. args.manager .. '|' .. args.manager .. ']]</span>') | |||
-- else | |||
-- value:wikitext(args.manager) | |||
-- end | |||
-- container:node(manager:node(name):node(value)) | |||
-- end | |||
if args.captain then | |||
container:node(RowWidget.make('Captain', args.captain, frame)) | |||
end | end | ||
if args.captain then | -- if args.captain then | ||
-- local captain = mw.html.create('div') | |||
-- :addClass('ib-row') | |||
-- local name = mw.html.create('div') | |||
-- :addClass('ib-rowName') | |||
-- :wikitext('Manager: ') | |||
-- local value = mw.html.create('div') | |||
-- local pageExists = frame:callParserFunction('#ifexist', args.captain, 'yes', 'no' ) | |||
-- if ( pageExists == 'yes' ) then | |||
-- value:wikitext('<span>[[' .. args.captain .. '|' .. args.captain .. ']]</span>') | |||
-- else | |||
-- value:wikitext(args.captain) | |||
-- end | |||
-- container:node(captain:node(name):node(value)) | |||
end | -- end | ||
container:node(Subheader.make('Links')) | container:node(Subheader.make('Links')) |
Revision as of 09:54, 2 September 2022
Documentation for this module may be created at Module:Infobox team/doc
local getArgs = require('Module:Arguments').getArgs
local Links = require('Module:Links')
local Header = require('Module:Infobox/Widget/Header')
local Subheader = require('Module:Infobox/Widget/Subheader')
local LinksWidget = require('Module:Infobox/Widget/Links')
local ListWidget = require('Module:Infobox/Widget/List')
local LocationWidget = require('Module:Infobox/Widget/Location')
local RowWidget = require('Module:Infobox/Widget/Row')
local Flags = require('Module:Flags')
local Infobox = {}
function Infobox.main(frame)
local args = getArgs(frame)
local currentTitleSplit = mw.text.split(mw.title.getCurrentTitle().text, '/')
local headerNode = Header.make(args.title or currentTitleSplit[2], args.image or '')
local container = mw.html.create('div')
:addClass('ib')
container:node(headerNode):node(Subheader.make('Team Information'))
if args.country then
container:node(RowWidget.make('Location', LocationWidget.make(args.country, args.city, currentTitleSplit[1] .. '/Teams')))
end
-- if args.location then
-- local countryName = Flags.CountryName(args.location)
-- local flag = Flags.icon(args.location, currentTitleSplit[1])
-- local location = mw.html.create('div')
-- :addClass('ib-row')
-- local link = ':Category:' .. currentTitleSplit[1] .. '/' .. countryName
-- local locationName = mw.html.create('span')
-- :wikitext('[[' .. link .. '|' .. countryName .. ']]')
-- local name = mw.html.create('div')
-- :addClass('ib-rowName')
-- :wikitext('Location: ')
-- local value = mw.html.create('div')
-- :wikitext(flag)
-- :node(locationName)
-- container:node(location:node(name):node(value))
-- end
if args.region then
container:node(RowWidget.make('Region', LocationWidget.make(args.region, nil, currentTitleSplit[1] .. '/Teams')))
end
-- if args.region then
-- local countryName = Flags.CountryName(args.region)
-- local flag = Flags.icon(args.region, currentTitleSplit[1])
-- local region = mw.html.create('div')
-- :addClass('ib-row')
-- local link = ':Category:' .. currentTitleSplit[1] .. '/' .. countryName
-- local regionName = mw.html.create('span')
-- :wikitext('[[' .. link .. '|' .. countryName .. ']]')
-- local name = mw.html.create('div')
-- :addClass('ib-rowName')
-- :wikitext('Region: ')
-- local value = mw.html.create('div')
-- :wikitext(flag)
-- :node(regionName)
-- container:node(region:node(name):node(value))
-- end
if args.founded then
container:node(RowWidget.make('Founded', args.founded))
end
-- if args.founded then
-- local founded = mw.html.create('div')
-- :addClass('ib-row')
-- local name = mw.html.create('div')
-- :addClass('ib-rowName')
-- :wikitext('Founded: ')
-- local value = mw.html.create('div')
-- :wikitext(args.founded)
-- container:node(founded:node(name):node(value))
-- end
if args.org then
container:node(RowWidget.make('Organization', args.org, frame))
end
-- if args.org then
-- local org = mw.html.create('div')
-- :addClass('ib-row')
-- local name = mw.html.create('div')
-- :addClass('ib-rowName')
-- :wikitext('Organization: ')
-- local value = mw.html.create('div')
-- local pageExists = frame:callParserFunction('#ifexist', args.org, 'yes', 'no' )
-- if ( pageExists == 'yes' ) then
-- value:wikitext('<span>[[' .. args.org .. '|' .. args.org .. ']]</span>')
-- else
-- value:wikitext(args.org)
-- end
-- container:node(org:node(name):node(value))
-- end
if args.sponsors then
container:node(RowWidget.make('Sponsors', ListWidget.make(args.sponsors)))
end
-- if args.sponsors then
-- local sponsors = mw.html.create('div')
-- :addClass('ib-row')
-- local name = mw.html.create('div')
-- :addClass('ib-rowName')
-- :wikitext('Sponsors: ')
-- local value = ListWidget.make(args.sponsors)
-- container:node(sponsors:node(name):node(value))
-- end
if args.coach then
container:node(RowWidget.make('Coach', args.coach, frame))
end
-- if args.coach then
-- local coach = mw.html.create('div')
-- :addClass('ib-row')
-- local name = mw.html.create('div')
-- :addClass('ib-rowName')
-- :wikitext('Coach: ')
-- local value = mw.html.create('div')
-- local pageExists = frame:callParserFunction('#ifexist', args.coach, 'yes', 'no' )
-- if ( pageExists == 'yes' ) then
-- value:wikitext('<span>[[' .. args.coach .. '|' .. args.coach .. ']]</span>')
-- else
-- value:wikitext(args.coach)
-- end
-- container:node(coach:node(name):node(value))
-- end
if args.manager then
container:node(RowWidget.make('Manager', args.manager, frame))
end
-- if args.manager then
-- local manager = mw.html.create('div')
-- :addClass('ib-row')
-- local name = mw.html.create('div')
-- :addClass('ib-rowName')
-- :wikitext('Manager: ')
-- local value = mw.html.create('div')
-- local pageExists = frame:callParserFunction('#ifexist', args.manager, 'yes', 'no' )
-- if ( pageExists == 'yes' ) then
-- value:wikitext('<span>[[' .. args.manager .. '|' .. args.manager .. ']]</span>')
-- else
-- value:wikitext(args.manager)
-- end
-- container:node(manager:node(name):node(value))
-- end
if args.captain then
container:node(RowWidget.make('Captain', args.captain, frame))
end
-- if args.captain then
-- local captain = mw.html.create('div')
-- :addClass('ib-row')
-- local name = mw.html.create('div')
-- :addClass('ib-rowName')
-- :wikitext('Manager: ')
-- local value = mw.html.create('div')
-- local pageExists = frame:callParserFunction('#ifexist', args.captain, 'yes', 'no' )
-- if ( pageExists == 'yes' ) then
-- value:wikitext('<span>[[' .. args.captain .. '|' .. args.captain .. ']]</span>')
-- else
-- value:wikitext(args.captain)
-- end
-- container:node(captain:node(name):node(value))
-- end
container:node(Subheader.make('Links'))
local transformedLinks = Links.transform(args)
local fullLinks = LinksWidget.make(transformedLinks, 'team')
container:node(fullLinks)
return container
end
return Infobox