Module:Infobox

From WikiPhone
Revision as of 22:29, 9 November 2025 by CaptainChris (talk | contribs)
Jump to navigation Jump to search

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

-- Module:Infobox
local p = {}

function p.infobox(frame)
    local args = frame:getParent().args
    local html = mw.html.create('table'):addClass('infobox')

    -- Title
    if args.title then
        html:tag('tr')
            :tag('th')
            :addClass('infobox-title')
            :wikitext(args.title)
    end

    -- Image
    if args.image then
        html:tag('tr')
            :tag('td')
            :addClass('infobox-image')
            :wikitext('[[File:' .. args.image .. '|200px]]')
    end

    -- Rows
    if args.rows then
        html:wikitext(args.rows)
    end

    -- Footer
    if args.footer then
        html:tag('tr')
            :tag('td')
            :addClass('infobox-footer')
            :wikitext(args.footer)
    end

    return tostring(html)
end

return p