Force Nativity onto its own infobox row.
Spell out Army branch abbreviations in the infobox.
Line 640: Line 640:
key = trim(key)
key = trim(key)
return RANK_MAP[key] or raw
return RANK_MAP[key] or raw
end
local BRANCH_MAP = {
['INF'] = 'Infantry',
['INFANTRY'] = 'Infantry',
['FA'] = 'Field Artillery',
['FIELD ARTILLERY'] = 'Field Artillery',
['CAC'] = 'Coast Artillery Corps',
['CA'] = 'Coast Artillery',
['COAST ARTILLERY'] = 'Coast Artillery',
['AC'] = 'Air Corps',
['AAF'] = 'Army Air Forces',
['AIR CORPS'] = 'Air Corps',
['QMC'] = 'Quartermaster Corps',
['QC'] = 'Quartermaster Corps',
['QUARTERMASTER'] = 'Quartermaster Corps',
['CAV'] = 'Cavalry',
['CAVALRY'] = 'Cavalry',
['CE'] = 'Corps of Engineers',
['ENG'] = 'Corps of Engineers',
['ENGINEERS'] = 'Corps of Engineers',
['CMP'] = 'Corps of Military Police',
['MP'] = 'Military Police',
['CWS'] = 'Chemical Warfare Service',
['AUS'] = 'Army of the United States',
['SC'] = 'Signal Corps',
['SIG'] = 'Signal Corps',
['SIG C'] = 'Signal Corps',
['SIGC'] = 'Signal Corps',
['SIGNAL CORPS'] = 'Signal Corps',
['ORD'] = 'Ordnance Department',
['ORDNANCE'] = 'Ordnance Department',
['MAC'] = 'Medical Administrative Corps',
['MC'] = 'Medical Corps',
['MD'] = 'Medical Department',
['TC'] = 'Transportation Corps',
['MI'] = 'Military Intelligence',
['MIS'] = 'Military Intelligence Service',
['INT'] = 'Intelligence',
['CIC'] = 'Counter Intelligence Corps',
['AGD'] = "Adjutant General's Department",
['USMC'] = 'United States Marine Corps',
['USMCR'] = 'United States Marine Corps Reserve',
['AA'] = 'Antiaircraft',
['AAA'] = 'Antiaircraft Artillery',
['TD'] = 'Tank Destroyer',
['FD'] = 'Finance Department',
['GSC'] = 'General Staff Corps',
['ARMD F'] = 'Armored Force',
['ARMD'] = 'Armored',
['ARMOR'] = 'Armor',
['SSF'] = 'Special Service Force',
['PA'] = 'Philippine Army',
['RCE'] = 'Royal Canadian Engineers',
['RCA'] = 'Royal Canadian Artillery',
['CHC'] = 'Chaplain Corps',
['CHP'] = 'Chaplain Corps',
['CAO'] = 'Civil Affairs',
['CAU'] = 'Civil Affairs',
}
local function expandBranchToken(raw)
raw = trim(raw)
if raw == '' then
return ''
end
local key = mw.ustring.upper(raw)
key = mw.ustring.gsub(key, '%.', '')
key = mw.ustring.gsub(key, '%s+', ' ')
key = trim(key)
if BRANCH_MAP[key] then
return BRANCH_MAP[key]
end
local left, right = mw.ustring.match(key, '^(.+) %((.+)%)$')
if left and right then
left = trim(left)
right = trim(right)
local leftExp = BRANCH_MAP[left] or left
local rightExp = BRANCH_MAP[right] or right
if BRANCH_MAP[left] or BRANCH_MAP[right] then
return leftExp .. ' (' .. rightExp .. ')'
end
end
return raw
end
local function expandBranch(raw)
raw = trim(raw)
if raw == '' then
return ''
end
local parts = {}
for part in mw.text.gsplit(raw, ';', true) do
part = expandBranchToken(part)
if part ~= '' then
table.insert(parts, part)
end
end
return table.concat(parts, '; ')
end
end


Line 733: Line 832:
addHeader(tbl, 'Military service')
addHeader(tbl, 'Military service')
addRow(tbl, 'Allegiance', 'United States')
addRow(tbl, 'Allegiance', 'United States')
local branch = prettyProse(parentArg(frame, 'class_branch'))
local branch = expandBranch(parentArg(frame, 'class_branch'))
if branch == '' then
if branch == '' then
branch = 'United States Army'
branch = 'United States Army'