Module:Soldier: Difference between revisions
Join date-only research notes and collapse duplicates |
Link Italian 5th class to Team IPW Italian 5 |
||
| Line 678: | Line 678: | ||
} | } | ||
return junk[spaced] == true | return junk[spaced] == true | ||
end | |||
local function normalizeIpwItalianCode(part) | |||
part = trim(part) | |||
if part == '' or isJunkIpwItalianLabel(part) then | |||
return nil | |||
end | |||
local spaced = mw.ustring.lower(mw.ustring.gsub(part, '%s+', ' ')) | |||
if mw.ustring.match(spaced, '^(italian )?5th class$') then | |||
return '5' | |||
end | |||
return part | |||
end | end | ||
| Line 740: | Line 752: | ||
if part ~= '' then | if part ~= '' then | ||
if pagePrefix == 'IPW Italian ' then | if pagePrefix == 'IPW Italian ' then | ||
local code = normalizeIpwItalianCode(part) | |||
if code then | |||
table.insert(out, string.format('[[Team %s%s|%s %s]]', pagePrefix, code, label, code)) | |||
else | |||
table.insert(out, part) | table.insert(out, part) | ||
end | end | ||
elseif isIpw then | elseif isIpw then | ||