Module:Super 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', default = mw.title.getCurrentTitle.text }, { name = 'character image' }, { name = 'CurrentAlias' }, { name = 'Nicknames', fn = ProcessingFns.stringToArray('\n') }, { name = 'Aliases', fn = ProcessingFns.stringToArray('\n') }, { name = 'Affiliation', fn = ProcessingFns.stringToArray('\n') }, { name = 'Ancestors', fn = ProcessingFns.stringToArray('\n') }, { name = 'Grandparents', fn = ProcessingFns.stringToArray('\n') }, { name = 'Parents', fn = ProcessingFns.stringToArray('\n') }, { name = 'Siblings', fn = ProcessingFns.stringToArray('\n') }, { name = 'Spouse' }, { name = 'Children', fn = ProcessingFns.stringToArray('\n') }, { name = 'Descendants', fn = ProcessingFns.stringToArray('\n') }, { name = 'Relatives', fn = ProcessingFns.stringToArray('\n') }, { name = 'Marital Status' }, { name = 'gender' }, { name = 'Eyes' }, { name = 'Hair' }, { name = 'Skin' }, { name = 'status' }, { name = 'Reality' }, { name = 'Cause of Death' }, { name = 'Identity' }, { name = 'Citizenship' }, { 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 :addHeader({ tag = 'th', content = 'Names and Titles' }, { subheader = true }) :addRow(			{				{ tag = 'th', content = 'CurrentAlias' },				{ tag = 'argtd', content = 'CurrentAlias' }			}		) :addRow(			{				{ tag = 'th', content = 'Nicknames' },				{ tag = 'argtd', content = 'Nicknames', fn = DisplayFns.list('unbulleted') }			},			{ hideIfEmpty = { 'Nicknames' } }		) :addRow(			{				{ tag = 'th', content = 'Aliases' },				{ tag = 'argtd', content = 'Aliases', fn = DisplayFns.list('unbulleted') }			},			{ hideIfEmpty = { 'Aliases' } }		) :addHeader({ tag = 'th', content = 'Affiliation and Relationships' }, { subheader = true }) :addRow(			{				{ tag = 'th', content = 'Affiliation' },				{ tag = 'argtd', content = 'Affiliation', fn = DisplayFns.list('unbulleted') }			}		) :addRow(			{				{ tag = 'th', content = 'Ancestors ' },				{ tag = 'argtd', content = 'Ancestors ', fn = DisplayFns.list('unbulleted') }			},			{ hideIfEmpty = { 'Ancestors' } }		) :addRow(			{				{ tag = 'th', content = 'Grandparents' },				{ tag = 'argtd', content = 'Grandparents', fn = DisplayFns.list('unbulleted') }			},			{ hideIfEmpty = { 'Grandparents' } }		) :addRow(			{				{ tag = 'th', content = 'Parents ' },				{ tag = 'argtd', content = 'Parents ', fn = DisplayFns.list('unbulleted') }			},			{ hideIfEmpty = { 'Parents' } }		) :addRow(			{				{ tag = 'th', content = 'Siblings' },				{ tag = 'argtd', content = 'Siblings', fn = DisplayFns.list('unbulleted') }			},			{ hideIfEmpty = { 'Siblings' } }		) :addRow(			{				{ tag = 'th', content = 'Spouse' },				{ tag = 'argtd', content = 'Spouse' }			},			{ hideIfEmpty = { 'Spouse' } }		) :addRow(			{				{ tag = 'th', content = 'Children' },				{ tag = 'argtd', content = 'Children', fn = DisplayFns.list('unbulleted') }			},			{ hideIfEmpty = { 'Children' } }		) :addRow(			{				{ tag = 'th', content = 'Descendants' },				{ tag = 'argtd', content = 'Descendants', fn = DisplayFns.list('unbulleted') }			},			{ hideIfEmpty = { 'Descendants' } }		) :addRow(			{				{ tag = 'th', content = 'Relatives' },				{ tag = 'argtd', content = 'Relatives', fn = DisplayFns.list('unbulleted') }			},			{ hideIfEmpty = { 'Relatives' } }		) :addRow(			{				{ tag = 'th', content = 'Marital Status' },				{ tag = 'argtd', content = 'Marital Status' }			}		) :addHeader({ tag = 'th', content = 'Physical Characteristics' }, { subheader = true }) :addRow(			{				{ tag = 'th', content = 'Gender' },				{ tag = 'argtd', content = 'gender' }			}		) :addRow(			{				{ tag = 'th', content = 'Height' },				{ tag = 'argtd', content = 'height' }			}		) :addRow(			{				{ tag = 'th', content = 'Eyes' },				{ tag = 'argtd', content = 'Eyes' }			}		) :addRow(			{				{ tag = 'th', content = 'Hair' },				{ tag = 'argtd', content = 'Hair' }			}		) :addRow(			{				{ tag = 'th', content = 'Skin' },				{ tag = 'argtd', content = 'Skin' }			},			{ hideIfEmpty = { 'Skin' } }		) :addHeader({ tag = 'th', content = 'Origin and Living Status' }, { subheader = true }) :addRow(			{				{ tag = 'th', content = 'Origin' },				{ tag = 'argtd', content = 'Origin' }			},			{ hideIfEmpty = { 'Origin' } }		) :addRow(			{				{ tag = 'th', content = 'Status' },				{ tag = 'argtd', content = 'status' }			}		) :addRow(			{				{ tag = 'th', content = 'Reality' },				{ tag = 'argtd', content = 'Reality' }			}		) :addRow(			{				{ tag = 'th', content = 'Cause of Death' },				{ tag = 'argtd', content = 'Cause of Death' }			},			{ hideIfEmpty = { 'Cause of Death' } }		) :addHeader({ tag = 'th', content = 'Personal Information' }, { subheader = true }) :addRow(			{				{ tag = 'th', content = 'Identity' },				{ tag = 'argtd', content = 'Identity' }			}		) :addRow(			{				{ tag = 'th', content = 'Citizenship' },				{ tag = 'argtd', content = 'Citizenship' }			}		) :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