Module:Danganronpa Character

-- -- Module for Template:Danganronpa Character

local getArgs  = require('Module:Arguments').getArgs local InfoboxBuilder = require('Module:InfoboxBuilder') local DisplayFns    = require('Module:DisplayFunctions') local ProcessingFns = require('Module:ProcessingFunctions') local constants = require('Module:Constants')

local p = {}

local function formatColor(color) if color and color ~= nil then return string.format(			"%s  ",			color,			color		); end end

local function formatHometown(list) if list == nil then return nil end return table.concat(list, ' ') end

function p.main(frame) local args = getArgs(frame) local infobox = InfoboxBuilder.new; infobox:setName('Danganronpa Character') :setParams{ { name = 'character name' }, { name = 'character image' }, { name = 'kanji' }, { name = 'romaji' }, { name = 'katakana' }, { name = 'englishtalent', fn = ProcessingFns.stringToArray('\n') }, { name = 'kanjitalent', fn = ProcessingFns.stringToArray('\n') }, { name = 'romajitalent', fn = ProcessingFns.stringToArray('\n') }, { name = 'littalent', fn = ProcessingFns.stringToArray('\n') }, { name = 'gender' }, { name = 'height' }, { name = 'birthday' }, { name = 'bloodtype' }, { name = 'likes', fn = ProcessingFns.stringToArray('\n') }, { name = 'dislikes', fn = ProcessingFns.stringToArray('\n') }, { name = 'status' }, { name = 'color' }, }		:setArgs(args) :processArgs if args['color'] and args['color'] ~= '' then infobox:setHeaderBackgroundColor(args['color']) end

infobox :addHeader({ tag = 'argth', content = 'character name' }) :addImage :addRow(			{				{ tag = 'th', content = 'Kanji' },				{ tag = 'argtd', content = 'kanji' }			}		) :addRow(			{				{ tag = 'th', content = 'Romaji' },				{ tag = 'argtd', content = 'romaji' }			}		) :addRow(			{				{ tag = 'th', content = 'Katakana' },				{ tag = 'argtd', content = 'katakana' }			}		) :addHeader({ tag = 'th', content = 'Talent' }, { subheader = true }) :addRow(			{				{ tag = 'th', content = 'English' },				{ tag = 'argtd', content = 'englishtalent', fn = DisplayFns.list('unbulleted') }			}		) :addRow(			{				{ tag = 'th', content = 'Kanji' },				{ tag = 'argtd', content = 'kanjitalent', fn = DisplayFns.list('unbulleted') }			}		) :addRow(			{				{ tag = 'th', content = 'Romaji' },				{ tag = 'argtd', content = 'romajitalent', fn = DisplayFns.list('unbulleted') }			}		) :addRow(			{				{ tag = 'th', content = 'Translated' },				{ tag = 'argtd', content = 'littalent', fn = DisplayFns.list('unbulleted') }			}		) :addHeader({ tag = 'th', content = 'Profile' }, { subheader = true }) :addRow(			{				{ tag = 'th', content = 'Gender' },				{ tag = 'argtd', content = 'gender' }			}		) :addRow(			{				{ tag = 'th', content = 'Height' },				{ tag = 'argtd', content = 'height' }			}		) :addRow(			{				{ tag = 'th', content = 'Birthday' },				{ tag = 'argtd', content = 'birthday' }			}		) :addRow(			{				{ tag = 'th', content = 'Blood Type' },				{ tag = 'argtd', content = 'bloodtype' }			}		) :addRow(			{				{ tag = 'th', content = 'Likes' },				{ tag = 'argtd', content = 'likes', fn = DisplayFns.list('unbulleted') }			}		) :addRow(			{				{ tag = 'th', content = 'Dislikes' },				{ tag = 'argtd', content = 'dislikes', fn = DisplayFns.list('unbulleted') }			},			{ hideIfEmpty = { 'dislikes' } }		) :addRow(			{				{ tag = 'th', content = 'Status' },				{ tag = 'argtd', content = 'status' }			}		) :addRow(			{				{ tag = 'th', content = 'Image color' },				{ tag = 'argtd', content = 'color', fn = formatColor }			}		) local categories = "" if mw.title.getCurrentTitle.namespace == 0 then categories = "" .. categories end

return infobox:tostring .. categories end

return p