Module:CatInfobox: Difference between revisions
(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...") |
No edit summary |
||
Line 15: | Line 15: | ||
headerStyle = headerStyle, | headerStyle = headerStyle, | ||
}) | }) | ||
:addImage(args.image, args.caption) | retval:addImage(args.image, args.caption) | ||
:addRow("Other name(s)", args.other_names) | if args.other_names then retval:addRow("Other name(s)", args.other_names) end | ||
:addRow("Breed", args.breed or "Unknown") | retval:addRow("Breed", args.breed or "Unknown") | ||
:addRow("Sex", args.sex or "Unknown") | :addRow("Sex", args.sex or "Unknown") | ||
:addRow("Rarity", args.rarity or "Unknown") | :addRow("Rarity", args.rarity or "Unknown") | ||
:addRow("Occupation", args.occupation) | if args.occupation then retval:addRow("Occupation", args.occupation) end | ||
:addRow("Appearance", args.appearance) | if args.appearance then retval:addRow("Appearance", args.appearance) end | ||
:addRow("Personality", args.personality) | if args.personality then retval:addRow("Personality", args.personality) end | ||
:addRow("First known sighting", args.first_sighting or "Unknown") | retval:addRow("First known sighting", args.first_sighting or "Unknown") | ||
:addHeader("Relations") | if args.partner or args.children or args.other_relations then | ||
retval:addHeader("Relations") | |||
:addRow("Partner", args.partner or "None") | |||
:addRow("Other", args.other_relations) | :addRow("Children", args.children or "None") | ||
end | |||
if args.other_relations then retval:addRow("Other", args.other_relations) end | |||
return retval | return retval | ||
end | end | ||
return p | return p |
Revision as of 08:00, 2 February 2024
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,
})
retval:addImage(args.image, args.caption)
if args.other_names then retval:addRow("Other name(s)", args.other_names) end
retval:addRow("Breed", args.breed or "Unknown")
:addRow("Sex", args.sex or "Unknown")
:addRow("Rarity", args.rarity or "Unknown")
if args.occupation then retval:addRow("Occupation", args.occupation) end
if args.appearance then retval:addRow("Appearance", args.appearance) end
if args.personality then retval:addRow("Personality", args.personality) end
retval:addRow("First known sighting", args.first_sighting or "Unknown")
if args.partner or args.children or args.other_relations then
retval:addHeader("Relations")
:addRow("Partner", args.partner or "None")
:addRow("Children", args.children or "None")
end
if args.other_relations then retval:addRow("Other", args.other_relations) end
return retval
end
return p