More actions
(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.title, headerStyle = headerStyle, } ) :addImage( args.image, args.caption ) :addRow( 'Foo', args.foo ) :addHead...") |
No edit summary Tag: Reverted |
||
Line 7: | Line 7: | ||
local headerStyle | local headerStyle | ||
if args.headerstyle and args.headerstyle ~= '' then | if args.headerstyle and args.headerstyle ~= '' then | ||
headerStyle = string.format( | headerStyle = string.format("background-color: %s;", args.headerstyle) | ||
else | else | ||
headerStyle = | headerStyle = "background-color: grey;" | ||
end | end | ||
local retval = capiunto.create( { | local retval = capiunto.create({ | ||
title = args. | title = args.name, | ||
headerStyle = headerStyle, | headerStyle = headerStyle, | ||
} ) | captionStyle = "text-align: center;", | ||
:addImage( args.image, args.caption ) | imageStyle = "text-align: center;", | ||
:addRow( | }) | ||
:addHeader( | retval:addImage("[[File:" .. args.image .. "|300px]]", args.caption) | ||
:addRow( | if args.other_names then retval:addRow("Other name(s)", args.other_names) end | ||
retval:addRow("Breed", args.breed or "Unknown") | |||
:addRow("Coat", args.coat 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.eye_color then retval:addRow("Eye Color", args.eye_color) 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.siblings or args.parents or args.other_relations then | |||
retval:addHeader("Relations") | |||
:addRow("Parents", args.parents or "Unknown") | |||
:addRow("Siblings", args.siblings or "Unknown") | |||
: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 | return retval | ||
end | end | ||
return p | return p |