Module:CharaInfo
From Little Tail Wiki
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.
In source editor, excluding any optional row will make that row not render. Leaving out any required fields 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 = Optional | gender = Optional | species = Optional | 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
-- Set header style, defaulting to 'background-color:grey' if not provided
local headerStyle = args.headerstyle and args.headerstyle ~= '' and
string.format('background-color:%s;', args.headerstyle) or 'background-color:grey;'
-- Create the infobox
local retval = capiunto.create({
title = tostring(mw.title.getCurrentTitle()),
headerStyle = headerStyle,
})
-- Add image and caption
if args.image then
retval:addImage(args.image, args.caption or '')
end
-- Add a general header
retval:addHeader('Info.')
-- Add rows only for fields that are not empty
local rows = {
{ 'Age', args.age },
{ 'Gender', args.gender },
{ 'Species', args.species },
{ 'Namesake', args.namesake },
{ 'Height', args.height },
{ 'Relatives', args.relatives },
{ 'Residence', args.residence },
{ 'Mecha', args.mecha },
{ 'Weapon Class', args.weapclass },
{ 'Vehicle', args.vehicle },
{ 'Voice Actor', args.voiceactor },
}
for _, row in ipairs(rows) do
local label, value = row[1], row[2]
if value and value ~= '' then
retval:addRow(label, value)
end
end
return retval
end
return p