Module:Infobox military conflict
Appearance
![]() | This module depends on the following other modules: |
![]() | This module uses TemplateStyles: |
Implements {{Infobox military conflict}}
require('Module:No globals')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local InfoboxImage = require('Module:InfoboxImage').InfoboxImage
function p.main(frame)
local args = getArgs(frame, {wrappers = 'Template:Infobox military conflict'})
local combatants
if args.combatants then
combatants = tonumber(args.combatants)
else
combatants = args.combatant3 and 3 or 2
end
local builder = mw.html.create()
if args.campaignbox then
builder = builder:tag('table')
:css('float', 'right')
:css('clear', 'right')
:css('background', 'transparent')
:css('margin', 0)
:css('padding', 0)
:tag('tr'):tag('td')
end
builder:wikitext('<table ' .. frame:expandTemplate{title = 'WPMILHIST Infobox style', args = {'main_box', 'vevent'}} .. '>')
builder:tag('tr')
:wikitext(string.format('<th class="summary" colspan="%d" %s>%s</th>',
combatants,
frame:expandTemplate{title = 'WPMILHIST Infobox style', args = {'header_bar'}},
args.conflict or mw.title.getCurrentTitle().text
))
if args.partof then
builder:tag('tr')
:wikitext(string.format('<td colspan="%d" %s>Part of %s</td>',
combatants,
frame:expandTemplate{title = 'WPMILHIST Infobox style', args = {'sub_header_bar'}},
args.partof
))
end
if args.image then
local alt
if args.caption then
alt = (args.alt or '') .. '<br />' .. args.caption
else
alt = args.alt
end
local imageArgs = {
image = args.image,
size = args.image_size,
sizedefault = 'frameless',
upright = 1,
alt = alt
}
builder:tag('tr')
:wikitext(string.format('<td colspan="%d" %s>%s</td>',
combatants,
frame:expandTemplate{title = 'WPMILHIST Infobox style', args = {'image_box'}},
InfoboxImage{args = imageArgs}
))
end
end
return p