Jump to content

Module:CustomInfobox

From Worldpedia, the free encyclopedia
Revision as of 04:36, 25 February 2025 by Arsait (talk | contribs) (Created page with "local p = {} -- Define a function to generate the custom infobox function p.main(frame) local name = frame.args.name or "Unknown" local image = frame.args.image or "No image" local caption = frame.args.caption or "No caption" local birth_date = frame.args.birth_date or "No birth date" local occupation = frame.args.occupation or "No occupation" local website = frame.args.website or "No website" local output = '<div class="custom-infobox">'...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

local p = {}

-- Define a function to generate the custom infobox
function p.main(frame)
    local name = frame.args.name or "Unknown"
    local image = frame.args.image or "No image"
    local caption = frame.args.caption or "No caption"
    local birth_date = frame.args.birth_date or "No birth date"
    local occupation = frame.args.occupation or "No occupation"
    local website = frame.args.website or "No website"

    local output = '<div class="custom-infobox">'
    output = output .. '<h2>' .. name .. '</h2>'
    output = output .. '<img src="' .. image .. '" alt="' .. name .. '" />'
    output = output .. '<p><strong>Caption: </strong>' .. caption .. '</p>'
    output = output .. '<p><strong>Birth Date: </strong>' .. birth_date .. '</p>'
    output = output .. '<p><strong>Occupation: </strong>' .. occupation .. '</p>'
    output = output .. '<p><strong>Website: </strong><a href="' .. website .. '">' .. website .. '</a></p>'
    output = output .. '</div>'

    return output
end

return p