Module:Infobox

From Daniel Larson Wiki
Revision as of 22:29, 3 May 2023 by YungCyraxxAlt (talk | contribs) (Replaced content with "-- This module implements the Infobox template. local p = {} function p.infobox(frame) local args = frame.args local title = args.title or '' local image = args.image or '' local caption = args.caption or '' local body = args.body or '' local output = '' output = output .. '<table class="infobox">\n' output = output .. '<caption>' .. title .. '</caption>\n' if image ~= '' then output = output .. '<tr>\n<td colspan="2"...")
Jump to navigation Jump to search

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

-- This module implements the Infobox template.

local p = {}

function p.infobox(frame)
    local args = frame.args
    local title = args.title or ''
    local image = args.image or ''
    local caption = args.caption or ''
    local body = args.body or ''

    local output = ''

    output = output .. '<table class="infobox">\n'
    output = output .. '<caption>' .. title .. '</caption>\n'

    if image ~= '' then
        output = output .. '<tr>\n<td colspan="2" style="text-align:center"><img src="' .. image .. '" alt="' .. caption .. '"></td>\n</tr>\n'
    end

    if body ~= '' then
        output = output .. '<tr>\n<td colspan="2">' .. body .. '</td>\n</tr>\n'
    end

    output = output .. '</table>'

    return output
end

return p