Module:CatInfobox

From StreetCatWiki
Revision as of 07:28, 2 February 2024 by Skyrina (talk | contribs) (Created page with "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 = args.name, headerStyle = headerStyle, }) :addImage(args.image, args.caption) :addRow("Other name(s)", args.other_nam...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

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 = args.name,
		headerStyle = headerStyle, 
	})
	:addImage(args.image, args.caption)
	:addRow("Other name(s)", args.other_names)
	:addRow("Breed", args.breed or "Unknown")
	:addRow("Sex", args.sex or "Unknown")
	:addRow("Rarity", args.rarity or "Unknown")
	:addRow("Occupation", args.occupation)
	:addRow("Appearance", args.appearance)
	:addRow("Personality", args.personality)
	:addRow("First known sighting", args.first_sighting or "Unknown")
	:addHeader("Relations")
	:addRow("Partner", args.partner)
	:addRow("Children", args.children)
	:addRow("Other", args.other_relations)
	return retval
end

return p