Module:Infobox
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Infobox/doc
local p = {}
function p.infobox( f )
local args = f.args
local titleObject = mw.title.getCurrentTitle()
local title = args.title or titleObject.rootText
local image = ''
if args.image and args.image ~= 'none' then
image = '<div class="infobox-image">[[File:' .. args.image .. ']]</div>'
end
if args.image2 and args.image2 ~= '' then
image = image .. '<div class="infobox-image">[[File:' .. args.image2 .. ']]</div>'
end
local footer = args.footer
if footer then
footer = '| class="infobox-footer" colspan="2" | ' .. footer
end
local html = {
'<div class="infobox infobox-' .. args.template .. '">',
'<div class="infobox-title">' .. title .. '</div>',
image,
'{| class="infobox-rows" cellspacing="1" cellpadding="4"',
'|-',
args.rows or '',
footer or '',
'|}',
'</div>'
}
return table.concat( html, '\n' )
end
return p