Module:Infobox avatar set

From Sekaipedia

To generate {{Infobox avatar set}}, invoke using the main function.


--------------------------
-- Module for [[Template:Infobox avatar set]]
------------------------
local getArgs        = require('Module:Arguments').getArgs
local InfoboxBuilder = require('Module:InfoboxBuilder')
local DisplayFns     = require('Module:DisplayFunctions')

local p = {}


function p.main(frame)
	local args = getArgs(frame, { wrappers = 'Template:Infobox avatar set' })
	local infobox = InfoboxBuilder.new()

	infobox:setName('Infobox avatar set')
		:setParams{
			{ name = 'set id' },
			{ name = 'set name', default = mw.title.getCurrentTitle().text },
			{ name = 'thumbnail' },
			{ name = 'japanese' },
			{ name = 'romaji' },
			{ name = 'date' },
		}
		:setArgs(args)
		:processArgs()

	infobox
		:addHeader({ tag = 'argth', content = 'set name' })
		:addImage({
			{ tag = 'argtd', content = 'thumbnail', fn = DisplayFns.image('256px') },
		})
		: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 = 'Set Information' }, { subheader = true })
		:addHeader({ tag = 'th', content = 'Acquisition Information'}, { subheader = true })
		:addRow({
			{ tag = 'th', content = 'Release date' },
			{ tag = 'argtd', content = 'date' },
		})

	local categories = ""
	if mw.title.getCurrentTitle().namespace == 0 then
		categories = "[[Category:Avatar sets]]" .. infobox:getCategories()
	end

	return infobox:tostring() .. categories
end

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