Latest revision |
Your text |
Line 4: |
Line 4: |
|
| |
|
| function p.main(frame) | | function p.main(frame) |
| local args = frame:getParent().args
| | local args = frame:getParent().args |
| local headerStyle
| | local headerStyle |
| if args.headerstyle and args.headerstyle ~= '' then
| | if args.headerstyle and args.headerstyle ~= '' then |
| headerStyle = string.format("background-color: %s;", args.headerstyle)
| | headerStyle = string.format("background-color: %s;", args.headerstyle) |
| else
| | else |
| headerStyle = "background-color: grey;"
| | headerStyle = "background-color: grey;" |
| end
| | end |
| local infoboxStyle = "width: 300px; max-width: 100%;"
| | local retval = capiunto.create({ |
| local retval = capiunto.create({
| | title = args.name, |
| title = args.title,
| | headerStyle = headerStyle, |
| titleStyle = "font-size: 2em;",
| | captionStyle = "text-align: center;", |
| headerStyle = headerStyle,
| | imageStyle = "text-align: center;", |
| captionStyle = "text-align: center;",
| | }) |
| infoboxStyle = infoboxStyle,
| | retval:addImage("[[File:" .. args.image .. "|300px]]", args.caption) |
| })
| | if args.other_names then retval:addRow("Other name(s)", args.other_names) end |
| local imageStyle = "display: block; margin-left: auto; margin-right: auto;"
| | retval:addRow("Breed", args.breed or "Unknown") |
| retval:addImage("[[File:" .. args.image .. "|293px|center|link=]]", args.caption, imageStyle) -- added "center" to the image properties
| | :addRow("Coat", args.coat or "Unknown") |
| if args.alias then retval:addRow("Aliases", args.alias) end
| | :addRow("Sex", args.sex or "Unknown") |
| if args.sex then retval:addRow("Sex", args.sex) end
| | :addRow("Rarity", args.rarity or "Unknown") |
| if args.nationality then retval:addRow("Nation from", args.nationality) end
| | if args.occupation then retval:addRow("Occupation", args.occupation) end |
| if args.breed then retval:addRow("Breed", args.breed) end
| | if args.appearance then retval:addRow("Appearance", args.appearance) end |
| if args.coat then retval:addRow("Coat", args.coat) end
| | if args.eye_color then retval:addRow("Eye Color", args.eye_color) end |
| if args.born then retval:addRow("Born", args.born) end
| | if args.personality then retval:addRow("Personality", args.personality) end |
| if args.abandoned then retval:addRow("Abandoned", args.abandoned) end
| | retval:addRow("First known sighting", args.first_sighting or "Unknown") |
| if args.rescued then retval:addRow("Rescued", args.rescued) end
| | if args.partner or args.children or args.siblings or args.parents or args.other_relations then |
| if args.died then retval:addRow("Died", args.died) end
| | retval:addHeader("Relations") |
| if args.cause_of_death then retval:addRow("Cause of death", args.cause_of_death) end
| | :addRow("Parents", args.parents or "Unknown") |
| if args.resting_place then retval:addRow("Resting place", args.resting_place) end
| | :addRow("Siblings", args.siblings or "Unknown") |
| if args.occupation then retval:addRow("Occupation", args.occupation) end
| | :addRow("Partner", args.partner or "None") |
| if args.mate then retval:addRow("Mate", args.mate) end
| | :addRow("Children", args.children or "None") |
| if args.weight then retval:addRow("Weight", args.weight) end
| | end |
| if args.height then retval:addRow("Height", args.height) end
| | if args.other_relations then retval:addRow("Other", args.other_relations) end |
| if args.owner then retval:addRow("Owner", args.owner) end
| | return retval |
| if args.known_for then retval:addRow("Known for", args.known_for) end
| |
| if args.sound then retval:addRow("Sound", args.sound) end
| |
| if args.social_media then retval:addRow("Social media", args.social_media) end
| |
| local footnote = "<div style=\"font-size: 0.8em; text-align: center;\">This is a footnote.</div>"
| |
| retval:addRow("", footnote)
| |
| | |
| return retval
| |
| end | | end |
|
| |
|
| return p | | return p |