Module:CharaInfo

From Little Tail Wiki
Module:CharaInfo

An example image (IMAGE REQUIRED)
Info.
Age X
Gender X
Species X
Namesake Optional
Height Optional
Relatives Optional
Residence Optional
Mecha Optional
Weapon Class Optional
Vehicle Optional
Voice Actor Optional

The CharaInfo infobox is dedicated to quickly listing off basic information about the article's featured character.

Infoboxes are put together via Capiunto, which calls upon a Lua-based module. This keeps infoboxes clean and easy to form as long as all required rows are present. Optional rows are available, but must still follow what's readily available from the module. All available rows are displayed in this page's CharaInfo infobox with optional rows marked as "Optional" and required ones marked with an X.

In source editor, excluding any optional row will make that row not render. Leaving out any required rows will throw an error over the page. HTML tags can be used within the infobox if necessary.

Specific Rows

Some rows are specifically made for certain characteristics that not all characters share.

Mecha - For those who possess Robos or other mechas as seen in Tail Concerto or Solatorobo.
Weapon Class - Refers to Fuga's weapon class system. Applies to all playable crew mates.
Vehicle - Specifically for characters in Fuga who commandeer tanks, military aircraft, etc..

Usage

{{CharaInfo
| headerstyle = (defaults to background-color:grey)
| image       = [[File:Waffle.png|200px]]
| caption     = An example image (IMAGE REQUIRED)
| ("Bio.")
| age         = X
| gender      = X
| species     = X
| namesake    = Optional
| height      = Optional
| relatives   = Optional
| residence   = Optional
| mecha		  = Optional
| weapclass   = Optional
| vehicle	  = Optional
| voiceactor  = Optional
}}

local capiunto = require 'capiunto'

local p = {}

function p.main(frame)
	local args = frame:getParent().args
	local headerStyle
	if args.headerstyle and args.headerstyle ~= '' then
		headerStyle = string.format('background-color:%s;', args.headerstyle)
	else
		headerStyle = 'background-color:grey;'
	end
	local retval = capiunto.create( {
		title = tostring(mw.title.getCurrentTitle()) ,
		headerStyle = headerStyle, 
	} )
	:addImage( args.image, args.caption )
	:addHeader( 'Info.' )
	:addRow( 'Age', args.age )
	:addRow( 'Gender', args.gender )
	:addRow( 'Species', args.species )

    if args.namesake then retval:addRow( 'Namesake', args.namesake ) end

	if args.height then retval:addRow( 'Height', args.height ) end

	if args.relatives then retval:addRow( 'Relatives', args.relatives ) end

	if args.residence then retval:addRow( 'Residence', args.residence ) end

	if args.mecha then retval:addRow( 'Mecha', args.mecha ) end

	if args.weapclass then retval:addRow( 'Weapon Class', args.weapclass ) end

	if args.vehicle then retval:addRow( 'Vehicle', args.vehicle ) end

	if args.voiceactor then retval:addRow( 'Voice Actor', args.voiceactor ) end
	
	return retval
end

return p