Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Infobox tournament: Difference between revisions

From Sekaipedia
Content added Content deleted
(basic tournament infobox)
 
No edit summary
Line 6: Line 6:


local p = {}
local p = {}

local function formatImage(image_name)
return string.format("[[File:%s|220px]]", image_name)
end



function p.main(frame)
function p.main(frame)
Line 14: Line 19:
:setParams{
:setParams{
{ name = 'tournament name' },
{ name = 'tournament name' },
{ name = 'image' },
{ name = 'image', dFunc = formatImage },
{ name = 'japanese' },
{ name = 'japanese' },
{ name = 'romaji' },
{ name = 'romaji' },

Revision as of 00:15, 1 May 2022

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(image_name)
	return string.format("[[File:%s|220px]]", image_name)
end


function p.main(frame)
	local args = getArgs(frame)
	local infobox = InfoboxBuilder.new();

	infobox:setName('Infobox tournament')
		:setParams{
			{ name = 'tournament name' },
			{ name = 'image', dFunc = formatImage },
			{ name = 'japanese' },
			{ name = 'romaji' },
			{ name = 'organizers' },
			{ name = 'sponsors' },
			{ name = 'prize pool' },
			{ name = 'teams' },
			{ name = 'previous' },
			{ name = 'next' }
		}
		: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 })


	return infobox:tostring()
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.