1,196
edits
m (1 revision imported) |
No edit summary |
||
Line 1: | Line 1: | ||
require('Module:No globals') | require('Module:No globals') | ||
local infoboxStyle = mw.loadData('Module: | local infoboxStyle = mw.loadData('Module:WPMILHIST Infobox style') | ||
local templatestyles = 'Module:Infobox military conflict/styles.css' | |||
local IMC = {} | local IMC = {} | ||
Line 94: | Line 95: | ||
:done() | :done() | ||
:tag('td') | :tag('td') | ||
:tag(' | :tag('div') | ||
:addClass('location') | :addClass('location') | ||
:wikitext(self.args.place or '{{{place}}}') -- hack so that people who don't know Lua know that this parameter is required | :wikitext(self.args.place or '{{{place}}}') -- hack so that people who don't know Lua know that this parameter is required | ||
:done() | :done() | ||
if self.args.coordinates then | if self.args.coordinates then | ||
builder:wikitext( | builder:wikitext(self.args.coordinates) | ||
end | end | ||
builder = builder:done():done() | builder = builder:done():done() | ||
Line 121: | Line 122: | ||
:done() | :done() | ||
:tag('td') | :tag('td') | ||
:addClass('status') | |||
:newline() | :newline() | ||
:wikitext(self.args.status or self.args.result) | :wikitext(self.args.status or self.args.result) | ||
Line 141: | Line 143: | ||
if self.args.campaignbox then | if self.args.campaignbox then | ||
-- this should be the same as using {{stack|clear=right|...}} | -- this should be the same as using {{stack|clear=right|...}} | ||
builder:wikitext(self.frame:expandTemplate{ title = 'stack begin', args = { clear='true'} }) | |||
end | end | ||
builder = builder:tag('table') | builder = builder:tag('table') | ||
:addClass('infobox vevent') | :addClass('infobox vevent') | ||
:cssText(infoboxStyle. | :cssText(infoboxStyle.main_box_raw) | ||
:css('width', self.args.width or | :css('width', self.args.width or nil) | ||
builder:tag('tr') | builder:tag('tr') | ||
Line 193: | Line 188: | ||
self:renderPerCombatant(builder, 'Commanders and leaders', 'commander') | self:renderPerCombatant(builder, 'Commanders and leaders', 'commander') | ||
for _,v in ipairs{'a','b','c','d'} do | |||
self:renderPerCombatant(builder, nil, 'commander', v) | |||
end | |||
self:renderPerCombatant(builder, 'Units involved', 'units') | self:renderPerCombatant(builder, 'Units involved', 'units') | ||
self:renderPerCombatant(builder, 'Strength', 'strength') | self:renderPerCombatant(builder, 'Strength', 'strength') | ||
Line 203: | Line 202: | ||
:tag('td') | :tag('td') | ||
:attr('colspan', self.combatants) | :attr('colspan', self.combatants) | ||
:css('border-top', infoboxStyle.section_border) | :css('border-top', infoboxStyle.section_border) | ||
:newline() | :newline() | ||
Line 213: | Line 211: | ||
:attr('colspan', self.combatants) | :attr('colspan', self.combatants) | ||
:css('border-top', infoboxStyle.internal_border) | :css('border-top', infoboxStyle.internal_border) | ||
:node(require('Module:Location map').main(self.frame, { | |||
self.args.map_type, | |||
relief = self.args.map_relief, | |||
coordinates = self.args.coordinates, | |||
width = self.args.map_size or 220, | |||
float = 'center', | |||
border = 'none', | |||
mark = self.args.map_mark, | |||
marksize = self.args.map_marksize or 8, | |||
label = self.args.map_label, | |||
alt = self.args.map_alt, | |||
caption = self.args.map_caption or ('Location within ' | |||
.. (require('Module:Location map').data(self.frame, {self.args.map_type, 'name'}))) | |||
})) | |||
end | end | ||
builder = builder:done() | builder = builder:done() | ||
if self.args.campaignbox then | if self.args.campaignbox then | ||
builder = builder:done() | builder = builder:done() | ||
builder:wikitext(self.args.campaignbox .. self.frame:expandTemplate{ title = 'stack end'}) | |||
end | end | ||
return builder | return builder | ||
Line 268: | Line 260: | ||
function p.main(frame) | function p.main(frame) | ||
return IMC.new(frame):render() | return frame:extensionTag{ name = 'templatestyles', args = { src = templatestyles} } .. tostring(IMC.new(frame):render()) | ||
end | end | ||
return p | return p |