<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.stargatewiki.noip.me/index.php?action=history&amp;feed=atom&amp;title=Module%3AInfobox_military_conflict</id>
	<title>Module:Infobox military conflict - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://en.stargatewiki.noip.me/index.php?action=history&amp;feed=atom&amp;title=Module%3AInfobox_military_conflict"/>
	<link rel="alternate" type="text/html" href="https://en.stargatewiki.noip.me/index.php?title=Module:Infobox_military_conflict&amp;action=history"/>
	<updated>2026-04-04T15:08:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://en.stargatewiki.noip.me/index.php?title=Module:Infobox_military_conflict&amp;diff=14887&amp;oldid=prev</id>
		<title>LIMAFOX76: Created page with &quot;require(&#039;Module:No globals&#039;)  local infoboxStyle = mw.loadData(&#039;Module:WPMILHIST Infobox style&#039;) local templatestyles = &#039;Module:Infobox military conflict/styles.css&#039;  local IM...&quot;</title>
		<link rel="alternate" type="text/html" href="https://en.stargatewiki.noip.me/index.php?title=Module:Infobox_military_conflict&amp;diff=14887&amp;oldid=prev"/>
		<updated>2021-05-15T15:43:20Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;require(&amp;#039;Module:No globals&amp;#039;)  local infoboxStyle = mw.loadData(&amp;#039;Module:WPMILHIST Infobox style&amp;#039;) local templatestyles = &amp;#039;Module:Infobox military conflict/styles.css&amp;#039;  local IM...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require(&amp;#039;Module:No globals&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local infoboxStyle = mw.loadData(&amp;#039;Module:WPMILHIST Infobox style&amp;#039;)&lt;br /&gt;
local templatestyles = &amp;#039;Module:Infobox military conflict/styles.css&amp;#039;&lt;br /&gt;
&lt;br /&gt;
local IMC = {}&lt;br /&gt;
IMC.__index = IMC&lt;br /&gt;
&lt;br /&gt;
function IMC:renderPerCombatant(builder, headerText, prefix, suffix)&lt;br /&gt;
	prefix = prefix or &amp;#039;&amp;#039;&lt;br /&gt;
	suffix = suffix or &amp;#039;&amp;#039;&lt;br /&gt;
	local colspans = {}&lt;br /&gt;
	&lt;br /&gt;
	-- This may result in colspans[1] getting set twice, but&lt;br /&gt;
	-- this is no big deal. The second set will be correct.&lt;br /&gt;
	local lastCombatant = 1&lt;br /&gt;
	&lt;br /&gt;
	for i = 1,self.combatants do&lt;br /&gt;
		if self.args[prefix .. i .. suffix] then&lt;br /&gt;
			colspans[lastCombatant] = i - lastCombatant&lt;br /&gt;
			lastCombatant = i&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local jointText = self.args[prefix .. (self.combatants + 1) .. suffix]&lt;br /&gt;
	&lt;br /&gt;
	if headerText and (colspans[1] or jointText) then&lt;br /&gt;
		builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
				:attr(&amp;#039;colspan&amp;#039;, self.combatants)&lt;br /&gt;
				:cssText(infoboxStyle.header_raw)&lt;br /&gt;
				:wikitext(headerText)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- The only time colspans[1] wouldn&amp;#039;t be set is if no&lt;br /&gt;
	-- combatant has a field with the given prefix and suffix.&lt;br /&gt;
	if colspans[1] then&lt;br /&gt;
		-- Since each found argument set the colspan for the previous&lt;br /&gt;
		-- one, the final one wasn&amp;#039;t set above, so set it now.&lt;br /&gt;
		colspans[lastCombatant] = self.combatants - lastCombatant + 1&lt;br /&gt;
		builder = builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		for i = 1,self.combatants do&lt;br /&gt;
			-- At this point, colspans[i] will be set for i=1 unconditionally, and for&lt;br /&gt;
			-- any other value of i where self.args[prefix .. i .. suffix] is set.&lt;br /&gt;
			if colspans[i] then&lt;br /&gt;
				builder:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
					-- don&amp;#039;t bother emitting colspan=&amp;quot;1&amp;quot;&lt;br /&gt;
					:attr(&amp;#039;colspan&amp;#039;, colspans[i] ~= 1 and colspans[i] or nil)&lt;br /&gt;
					:css(&amp;#039;width&amp;#039;, math.floor(100 / self.combatants * colspans[i] + 0.5) .. &amp;#039;%&amp;#039;)&lt;br /&gt;
					-- no border on the right of the rightmost column&lt;br /&gt;
					:css(&amp;#039;border-right&amp;#039;, i ~= lastCombatant and infoboxStyle.internal_border or nil)&lt;br /&gt;
					-- no padding on the left of the leftmost column&lt;br /&gt;
					:css(&amp;#039;padding-left&amp;#039;, i ~= 1 and &amp;#039;0.25em&amp;#039; or nil)&lt;br /&gt;
					-- don&amp;#039;t show the border if we&amp;#039;re directly under a header&lt;br /&gt;
					:css(&amp;#039;border-top&amp;#039;, not headerText and infoboxStyle.internal_border or nil)&lt;br /&gt;
					:newline()&lt;br /&gt;
					:wikitext(self.args[prefix .. i .. suffix])&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if jointText then&lt;br /&gt;
		builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:attr(&amp;#039;colspan&amp;#039;, self.combatants)&lt;br /&gt;
				:css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
				-- don&amp;#039;t show the border if we&amp;#039;re directly under a header&lt;br /&gt;
				:css(&amp;#039;border-top&amp;#039;, (not headerText or colspans[1]) and infoboxStyle.internal_border or nil)&lt;br /&gt;
				:newline()&lt;br /&gt;
				:wikitext(jointText)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function IMC:renderHeaderTable(builder)&lt;br /&gt;
	builder = builder:tag(&amp;#039;table&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;width&amp;#039;, &amp;#039;100%&amp;#039;)&lt;br /&gt;
		:css(&amp;#039;margin&amp;#039;, 0)&lt;br /&gt;
		:css(&amp;#039;padding&amp;#039;, 0)&lt;br /&gt;
		:css(&amp;#039;border&amp;#039;, 0)&lt;br /&gt;
&lt;br /&gt;
	if self.args.date then&lt;br /&gt;
		builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;padding-right&amp;#039;, &amp;#039;1em&amp;#039;)&lt;br /&gt;
				:wikitext(&amp;#039;Date&amp;#039;)&lt;br /&gt;
			:done()&lt;br /&gt;
			:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:wikitext(self.args.date)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	builder = builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;padding-right&amp;#039;, &amp;#039;1em&amp;#039;)&lt;br /&gt;
			:wikitext(&amp;#039;Location&amp;#039;)&lt;br /&gt;
		:done()&lt;br /&gt;
		:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
				:addClass(&amp;#039;location&amp;#039;)&lt;br /&gt;
				:wikitext(self.args.place or &amp;#039;{&amp;amp;#123;{place}&amp;amp;#125;}&amp;#039;) -- hack so that people who don&amp;#039;t know Lua know that this parameter is required&lt;br /&gt;
			:done()&lt;br /&gt;
	if self.args.coordinates then&lt;br /&gt;
		builder:wikitext(self.args.coordinates)&lt;br /&gt;
	end&lt;br /&gt;
	builder = builder:done():done()&lt;br /&gt;
&lt;br /&gt;
	-- only for &amp;quot;Putsch&amp;quot;&lt;br /&gt;
    if self.args.action then&lt;br /&gt;
		builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;padding-right&amp;#039;, &amp;#039;1em&amp;#039;)&lt;br /&gt;
				:wikitext(self.args.action and &amp;#039;Action&amp;#039;)&lt;br /&gt;
			:done()&lt;br /&gt;
			:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:wikitext(self.args.action)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if self.args.status or self.args.result then&lt;br /&gt;
		builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;padding-right&amp;#039;, &amp;#039;1em&amp;#039;)&lt;br /&gt;
				:wikitext(self.args.status and &amp;#039;Status&amp;#039; or &amp;#039;Result&amp;#039;)&lt;br /&gt;
			:done()&lt;br /&gt;
			:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:addClass(&amp;#039;status&amp;#039;)&lt;br /&gt;
				:newline()&lt;br /&gt;
				:wikitext(self.args.status or self.args.result)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if self.args.territory then&lt;br /&gt;
		builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;padding-right&amp;#039;, &amp;#039;1em&amp;#039;)&lt;br /&gt;
				:wikitext(&amp;#039;Territorial&amp;lt;br /&amp;gt;changes&amp;#039;)&lt;br /&gt;
			:done()&lt;br /&gt;
			:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:newline()&lt;br /&gt;
				:wikitext(self.args.territory)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function IMC:render()&lt;br /&gt;
	local builder = mw.html.create()&lt;br /&gt;
	if self.args.campaignbox then&lt;br /&gt;
		-- this should be the same as using {{stack|clear=right|...}}&lt;br /&gt;
		builder:wikitext(self.frame:expandTemplate{ title = &amp;#039;stack begin&amp;#039;, args = { clear=&amp;#039;true&amp;#039;} })&lt;br /&gt;
	end&lt;br /&gt;
	builder = builder:tag(&amp;#039;table&amp;#039;)&lt;br /&gt;
		:addClass(&amp;#039;infobox vevent&amp;#039;)&lt;br /&gt;
		:cssText(infoboxStyle.main_box_raw)&lt;br /&gt;
		:css(&amp;#039;width&amp;#039;, self.args.width or nil)&lt;br /&gt;
&lt;br /&gt;
	builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		:tag(&amp;#039;th&amp;#039;)&lt;br /&gt;
			:addClass(&amp;#039;summary&amp;#039;)&lt;br /&gt;
			:attr(&amp;#039;colspan&amp;#039;, self.combatants)&lt;br /&gt;
			:cssText(infoboxStyle.header_raw)&lt;br /&gt;
			:wikitext(self.args.conflict or mw.title.getCurrentTitle().text)&lt;br /&gt;
	if self.args.partof then&lt;br /&gt;
		builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:attr(&amp;#039;colspan&amp;#039;, self.combatants)&lt;br /&gt;
				:cssText(infoboxStyle.sub_header_raw)&lt;br /&gt;
				:wikitext(&amp;#039;Part of &amp;#039; .. self.args.partof)&lt;br /&gt;
	end&lt;br /&gt;
	if self.args.image then&lt;br /&gt;
		builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:attr(&amp;#039;colspan&amp;#039;, self.combatants)&lt;br /&gt;
				:cssText(infoboxStyle.image_box_raw)&lt;br /&gt;
				:wikitext(string.format(&amp;#039;%s%s%s&amp;#039;,&lt;br /&gt;
					require(&amp;#039;Module:InfoboxImage&amp;#039;).InfoboxImage{args = {&lt;br /&gt;
						image = self.args.image,&lt;br /&gt;
						size = self.args.image_size,&lt;br /&gt;
						sizedefault = &amp;#039;frameless&amp;#039;,&lt;br /&gt;
						upright = 1,&lt;br /&gt;
						alt = self.args.alt&lt;br /&gt;
					}},&lt;br /&gt;
					self.args.caption and &amp;#039;&amp;lt;br /&amp;gt;&amp;#039; or &amp;#039;&amp;#039;,&lt;br /&gt;
					self.args.caption or &amp;#039;&amp;#039;&lt;br /&gt;
				))&lt;br /&gt;
	end&lt;br /&gt;
	self:renderHeaderTable(builder:tag(&amp;#039;tr&amp;#039;):tag(&amp;#039;td&amp;#039;):attr(&amp;#039;colspan&amp;#039;, self.combatants))&lt;br /&gt;
	self:renderPerCombatant(builder, self.args.combatants_header or &amp;#039;Belligerents&amp;#039;, &amp;#039;combatant&amp;#039;)&lt;br /&gt;
	-- can be un-hardcoded once gerrit:165108 is merged&lt;br /&gt;
	for _,v in ipairs{&amp;#039;a&amp;#039;,&amp;#039;b&amp;#039;,&amp;#039;c&amp;#039;,&amp;#039;d&amp;#039;} do&lt;br /&gt;
		self:renderPerCombatant(builder, nil, &amp;#039;combatant&amp;#039;, v)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	self:renderPerCombatant(builder, &amp;#039;Commanders and leaders&amp;#039;, &amp;#039;commander&amp;#039;)&lt;br /&gt;
	for _,v in ipairs{&amp;#039;a&amp;#039;,&amp;#039;b&amp;#039;,&amp;#039;c&amp;#039;,&amp;#039;d&amp;#039;} do&lt;br /&gt;
		self:renderPerCombatant(builder, nil, &amp;#039;commander&amp;#039;, v)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	self:renderPerCombatant(builder, &amp;#039;Units involved&amp;#039;, &amp;#039;units&amp;#039;)&lt;br /&gt;
	self:renderPerCombatant(builder, &amp;#039;Strength&amp;#039;, &amp;#039;strength&amp;#039;)&lt;br /&gt;
	self:renderPerCombatant(builder, &amp;#039;Political support&amp;#039;, &amp;#039;polstrength&amp;#039;)&lt;br /&gt;
	self:renderPerCombatant(builder, &amp;#039;Military support&amp;#039;, &amp;#039;milstrength&amp;#039;)&lt;br /&gt;
	self:renderPerCombatant(builder, &amp;#039;Casualties and losses&amp;#039;, &amp;#039;casualties&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	if self.args.notes then&lt;br /&gt;
		builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:attr(&amp;#039;colspan&amp;#039;, self.combatants)&lt;br /&gt;
				:css(&amp;#039;border-top&amp;#039;, infoboxStyle.section_border)&lt;br /&gt;
				:newline()&lt;br /&gt;
				:wikitext(self.args.notes)&lt;br /&gt;
	end&lt;br /&gt;
	if self.args.map_type then&lt;br /&gt;
		builder:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:attr(&amp;#039;colspan&amp;#039;, self.combatants)&lt;br /&gt;
				:css(&amp;#039;border-top&amp;#039;, infoboxStyle.internal_border)&lt;br /&gt;
				:node(require(&amp;#039;Module:Location map&amp;#039;).main(self.frame, {&lt;br /&gt;
					self.args.map_type,&lt;br /&gt;
					relief = self.args.map_relief,&lt;br /&gt;
					coordinates = self.args.coordinates,&lt;br /&gt;
					width = self.args.map_size or 220,&lt;br /&gt;
					float = &amp;#039;center&amp;#039;,&lt;br /&gt;
					border = &amp;#039;none&amp;#039;,&lt;br /&gt;
					mark = self.args.map_mark,&lt;br /&gt;
					marksize = self.args.map_marksize or 8,&lt;br /&gt;
					label = self.args.map_label,&lt;br /&gt;
					alt = self.args.map_alt,&lt;br /&gt;
					caption = self.args.map_caption or (&amp;#039;Location within &amp;#039; &lt;br /&gt;
						.. (require(&amp;#039;Module:Location map&amp;#039;).data(self.frame, {self.args.map_type, &amp;#039;name&amp;#039;})))&lt;br /&gt;
				}))&lt;br /&gt;
	end&lt;br /&gt;
	builder = builder:done()&lt;br /&gt;
	if self.args.campaignbox then&lt;br /&gt;
		builder = builder:done()&lt;br /&gt;
		builder:wikitext(self.args.campaignbox .. self.frame:expandTemplate{ title = &amp;#039;stack end&amp;#039;})&lt;br /&gt;
	end&lt;br /&gt;
	return builder&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function IMC.new(frame, args)&lt;br /&gt;
	if not args then&lt;br /&gt;
		args = require(&amp;#039;Module:Arguments&amp;#039;).getArgs(frame, {wrappers = &amp;#039;Template:Infobox military conflict&amp;#039;})&lt;br /&gt;
	end&lt;br /&gt;
	local obj = {&lt;br /&gt;
		frame = frame,&lt;br /&gt;
		args = args&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	-- until gerrit:165108 is merged, there&amp;#039;s still a cap on combatants, but as soon as it merges, we can update this little bit of code to uncap it&lt;br /&gt;
	-- also, don&amp;#039;t try to make this more efficient, or references could be in the wrong order&lt;br /&gt;
	obj.combatants = 2&lt;br /&gt;
	for _,v in ipairs{&amp;#039;&amp;#039;, &amp;#039;a&amp;#039;, &amp;#039;b&amp;#039;, &amp;#039;c&amp;#039;, &amp;#039;d&amp;#039;} do&lt;br /&gt;
		for i = 1,5 do&lt;br /&gt;
			if args[&amp;#039;combatant&amp;#039; .. i .. v] then&lt;br /&gt;
				obj.combatants = math.max(obj.combatants, i)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return setmetatable(obj, IMC)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	return frame:extensionTag{ name = &amp;#039;templatestyles&amp;#039;, args = { src = templatestyles} } .. tostring(IMC.new(frame):render())&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>LIMAFOX76</name></author>
	</entry>
</feed>