Module:Soldier: Difference between revisions
Fix Lua keyword keys; place-name formatting |
Fix acronym table.insert; place-name formatting |
||
| Line 109: | Line 109: | ||
local SMALL_WORDS = { | local SMALL_WORDS = { | ||
of = true, the = true, to = true, a = true, an = true, at = true, by = true, | |||
} | } | ||
SMALL_WORDS['and'] = true | |||
SMALL_WORDS['for'] = true | |||
SMALL_WORDS['in'] = true | |||
SMALL_WORDS['or'] = true | |||
local STATE_NAME = { | local STATE_NAME = { | ||
| Line 131: | Line 134: | ||
al = 'Alabama', ak = 'Alaska', az = 'Arizona', ar = 'Arkansas', ca = 'California', | al = 'Alabama', ak = 'Alaska', az = 'Arizona', ar = 'Arkansas', ca = 'California', | ||
co = 'Colorado', ct = 'Connecticut', de = 'Delaware', fl = 'Florida', ga = 'Georgia', | co = 'Colorado', ct = 'Connecticut', de = 'Delaware', fl = 'Florida', ga = 'Georgia', | ||
hi = 'Hawaii', id = 'Idaho', il = 'Illinois | hi = 'Hawaii', id = 'Idaho', il = 'Illinois', ia = 'Iowa', | ||
ks = 'Kansas', ky = 'Kentucky', la = 'Louisiana', me = 'Maine', md = 'Maryland', | ks = 'Kansas', ky = 'Kentucky', la = 'Louisiana', me = 'Maine', md = 'Maryland', | ||
ma = 'Massachusetts', mi = 'Michigan', mn = 'Minnesota', ms = 'Mississippi', | ma = 'Massachusetts', mi = 'Michigan', mn = 'Minnesota', ms = 'Mississippi', | ||
mo = 'Missouri', mt = 'Montana', ne = 'Nebraska', nv = 'Nevada', nh = 'New Hampshire', | mo = 'Missouri', mt = 'Montana', ne = 'Nebraska', nv = 'Nevada', nh = 'New Hampshire', | ||
nj = 'New Jersey', nm = 'New Mexico', ny = 'New York', nc = 'North Carolina', | nj = 'New Jersey', nm = 'New Mexico', ny = 'New York', nc = 'North Carolina', | ||
nd = 'North Dakota', oh = 'Ohio', ok = 'Oklahoma | nd = 'North Dakota', oh = 'Ohio', ok = 'Oklahoma', pa = 'Pennsylvania', | ||
ri = 'Rhode Island', sc = 'South Carolina', sd = 'South Dakota', tn = 'Tennessee', | ri = 'Rhode Island', sc = 'South Carolina', sd = 'South Dakota', tn = 'Tennessee', | ||
tx = 'Texas', ut = 'Utah', vt = 'Vermont', va = 'Virginia', wa = 'Washington', | tx = 'Texas', ut = 'Utah', vt = 'Vermont', va = 'Virginia', wa = 'Washington', | ||
wv = 'West Virginia', wi = 'Wisconsin', wy = 'Wyoming', dc = 'Washington, D.C.', | wv = 'West Virginia', wi = 'Wisconsin', wy = 'Wyoming', dc = 'Washington, D.C.', | ||
} | } | ||
STATE_ABBR['in'] = 'Indiana' | |||
STATE_ABBR['or'] = 'Oregon' | |||
local TWO_WORD_STATE = { | local TWO_WORD_STATE = { | ||
| Line 156: | Line 161: | ||
local PLACE_PREP = { | local PLACE_PREP = { | ||
at | at = true, from = true, near = true, of = true, | ||
} | } | ||
PLACE_PREP['in'] = true | |||
local function stateKey(w) | local function stateKey(w) | ||
| Line 210: | Line 216: | ||
local up = mw.ustring.upper(bare) | local up = mw.ustring.upper(bare) | ||
if ACRONYMS[up] then | if ACRONYMS[up] then | ||
local replaced = mw.ustring.gsub(w, bare, up, 1) | |||
table.insert(out, replaced) | |||
else | else | ||
local low = mw.ustring.lower(w) | local low = mw.ustring.lower(w) | ||
| Line 752: | Line 759: | ||
addRow(tbl, 'IPW (German)', teamLinkList(parentArg(frame, 'ipw_ge'), 'IPW ', 'IPW')) | addRow(tbl, 'IPW (German)', teamLinkList(parentArg(frame, 'ipw_ge'), 'IPW ', 'IPW')) | ||
addRow(tbl, 'IPW (Italian)', teamLinkList(parentArg(frame, 'ipw_it'), 'IPW Italian ', 'IPW Italian')) | addRow(tbl, 'IPW (Italian)', teamLinkList(parentArg(frame, 'ipw_it'), 'IPW Italian ', 'IPW Italian')) | ||
addRow(tbl, 'LOC', parentArg(frame, 'loc')) | addRow(tbl, 'LOC', parentArg(frame, 'loc')) | ||
addRow(tbl, 'Arrived', parentArg(frame, 'date_arrive')) | addRow(tbl, 'Arrived', parentArg(frame, 'date_arrive')) | ||