×
Create a new article
Write your page title here:
We currently have 6 articles on NOISZ Wiki. Type your article name above or click on one of the titles below and start writing!



NOISZ Wiki
6Articles

Module:Character Infobox: Difference between revisions

(Created page with "local capiunto = require 'capiunto' capiunto.create( { title1 = {{PAGENAME}} } ) :addImage( args.image1, args.caption ) :addHeader( 'A header between the data rows' ) :addRow( 'Caption', args.caption1 ) :addRow( 'Voice', args.voice ) :addRow( 'JP Name', args.jpname ) :addHeader( 'Physical' ) :addRow( 'Also known as', args.also_known_as ) :addRow( 'Eye Colour', args.eye_colour ) :addRow( 'Hair Colour', args.hair_colour ) :addRow( 'Height', args.height ) :addHeader( 'Biog...")
 
No edit summary
 
(44 intermediate revisions by the same user not shown)
Line 1: Line 1:
local capiunto = require 'capiunto'
local capiunto = require 'capiunto'
capiunto.create( {
local p = {}
title1 = {{PAGENAME}}
function p.main(frame)
} )
local args = frame:getParent().args
:addImage( args.image1, args.caption )
local infobox = capiunto.create( {
:addHeader( 'A header between the data rows' )
title = tostring(mw.title.getCurrentTitle())
:addRow( 'Caption', args.caption1 )
    } )
:addRow( 'Voice', args.voice )
if args.image1 then
:addRow( 'JP Name', args.jpname )
infobox:addImage('[[File:' .. args.image1 .. '|200px]]', args.caption )
:addHeader( 'Physical' )
end
:addRow( 'Also known as', args.also_known_as )
local attributes =
:addRow( 'Eye Colour', args.eye_colour )
{
:addRow( 'Hair Colour', args.hair_colour )
{'Voice', args.voice },
:addRow( 'Height', args.height )
{ 'JP Name', args.jpname },
:addHeader( 'Biographical' )
{ 'Also known as', args.also_known_as }
:addRow( 'Age', args.age )
}
:addRow ( 'Birthday', args.birthday )
local physical =
:addRow ( 'Likes', args.likes )
{
:addRow ( 'Dislikes', args.dislikes )
{ 'Eye Colour', args.eye_colour },
:addRow ( 'Relationships', args.relationships )
{ 'Hair Colour', args.hair_colour },
{ 'Height', args.height }
}
local biographical =
{
{ 'Age', args.age },
{ 'Birthday', args.birthday },
{ 'Likes', args.likes },
{ 'Dislikes', args.dislikes },
{ 'Relationships', args.relationships }
}
if args.voice or args.jpname or args.also_known_as then
for _, row in ipairs(attributes) do
local label, value = row[1], row[2]
if value and value ~= '' then
          infobox:addRow(label, value)
end
end
end
if args.eye_colour or args.hair_colour or args.height then
infobox:addHeader( 'Physical' )
for _, row in ipairs(physical) do
local label, value = row[1], row[2]
if value and value ~= '' then
          infobox:addRow(label, value)
end
end
end
if args.age or args.birthday or args.likes or args.dislikes or args.relationships then
infobox:addHeader( 'Biographical' )
for _, row in ipairs(biographical) do
local label, value = row[1], row[2]
if value and value ~= '' then
          infobox:addRow(label, value)
end
end
end
    return infobox
end
 
return p

Latest revision as of 10:01, 4 June 2025

Documentation for this module may be created at Module:Character Infobox/doc

local capiunto = require 'capiunto'
local p = {}
function p.main(frame) 
	local args = frame:getParent().args
	local infobox = capiunto.create( {
		title = tostring(mw.title.getCurrentTitle())
    	} )
	if args.image1 then
		infobox:addImage('[[File:' .. args.image1 .. '|200px]]', args.caption )
	end
	local attributes = 
	{
		{'Voice', args.voice },
		{ 'JP Name', args.jpname },
		{ 'Also known as', args.also_known_as }
	}
	local physical = 
	{
		{ 'Eye Colour', args.eye_colour },
		{ 'Hair Colour', args.hair_colour },
		{ 'Height', args.height }
	}
	local biographical = 
	{
		{ 'Age', args.age },
		{ 'Birthday', args.birthday },
		{ 'Likes', args.likes },
		{ 'Dislikes', args.dislikes },
		{ 'Relationships', args.relationships }
	}
	if args.voice or args.jpname or args.also_known_as then
		for _, row in ipairs(attributes) do
			local label, value = row[1], row[2]
			if value and value ~= '' then
           		infobox:addRow(label, value)
			end
		end
	end
	if args.eye_colour or args.hair_colour or args.height then
		infobox:addHeader( 'Physical' )
		for _, row in ipairs(physical) do
			local label, value = row[1], row[2]
			if value and value ~= '' then
           		infobox:addRow(label, value)
			end
		end
	end
	if args.age or args.birthday or args.likes or args.dislikes or args.relationships then
		infobox:addHeader( 'Biographical' )
		for _, row in ipairs(biographical) do
			local label, value = row[1], row[2]
			if value and value ~= '' then
           		infobox:addRow(label, value)
			end
		end
	end
	
    return infobox
end

return p