Content added Content deleted
mNo edit summary |
mNo edit summary |
||
Line 42: | Line 42: | ||
{ name = 'prize pool' }, |
{ name = 'prize pool' }, |
||
{ name = 'teams' }, |
{ name = 'teams' }, |
||
{ name = 'previous', |
{ name = 'previous', default = '', dFunc = formatPrevious }, |
||
{ name = 'next', |
{ name = 'next', default = '', dFunc = formatNext } |
||
} |
} |
||
:setArgs(args) |
:setArgs(args) |
Revision as of 00:26, 1 May 2022
This module depends on the following other modules: |
To generate {{Infobox tournament}}, invoke using the main function.
--------------------------
-- Module for [[Template:Infobox tournament]]
------------------------
local getArgs = require('Module:Arguments').getArgs
local InfoboxBuilder = require('Module:InfoboxBuilder new')
local p = {}
local function formatImage(imageName)
return string.format("[[File:%s|220px]]", imageName)
end
local function formatPrevious(previousTourney)
if previousTourney then
return string.format('๐กฐ [[%s]]', previousTourney)
end
return nil
end
local function formatNext(nextTourney)
if nextTourney then
return string.format('[[%s]] ๐กฒ', nextTourney)
end
return nil
end
function p.main(frame)
local args = getArgs(frame)
local infobox = InfoboxBuilder.new();
infobox:setName('Infobox tournament')
:setParams{
{ name = 'tournament name', default = mw.title.getCurrentTitle().text },
{ name = 'image', dFunc = formatImage },
{ name = 'japanese' },
{ name = 'romaji' },
{ name = 'organizers' },
{ name = 'sponsors' },
{ name = 'prize pool' },
{ name = 'teams' },
{ name = 'previous', default = '', dFunc = formatPrevious },
{ name = 'next', default = '', dFunc = formatNext }
}
:setArgs(args)
:processArgs()
infobox
:addHeader({ tag = 'argth', content = 'tournament name' })
:addImage({
{ tag = 'argtd', content = 'image' },
})
:addRow(
{
{ tag = 'th', content = 'Japanese' },
{ tag = 'argtd', content = 'japanese' }
},
{ hideIfEmpty = { 'japanese' } }
)
:addRow(
{
{ tag = 'th', content = 'Romaji' },
{ tag = 'argtd', content = 'romaji' }
},
{ hideIfEmpty = { 'romaji' } }
)
:addHeader({ tag = 'th', content = 'Tournament Information' }, { subheader = true })
:addRow(
{
{ tag = 'th', content = 'Organizer(s)' },
{ tag = 'argtd', content = 'organizers' }
}
)
:addRow(
{
{ tag = 'th', content = 'Sponsor(s)' },
{ tag = 'argtd', content = 'sponsors' }
},
{ hideIfEmpty = { 'sponsors' } }
)
:addHeader({ tag = 'th', content = 'Chronology' }, { subheader = true })
:addRow(
{
{ tag = 'argtd', content = 'previous', colspan = 13 },
{ tag = 'td', content = '', colspan = 4 },
{ tag = 'argtd', content = 'next', colspan = 13 }
}
)
return infobox:tostring()
end
return p