Story cue + same class/team rails
Related rail: include MII/|teams=/notes teams; roster co-assignment note
Line 2,399: Line 2,399:
local pageTitle = mw.title.getCurrentTitle().prefixedText
local pageTitle = mw.title.getCurrentTitle().prefixedText
local classRaw = parentArg(frame, 'class_number')
local classRaw = parentArg(frame, 'class_number')
local ipwGe = parentArg(frame, 'ipw_ge')
local ipwIt = parentArg(frame, 'ipw_it')


local sections = {}
local sections = {}


local function addTeam(label, teamPage, where)
local function addTeamBlock(teamName, where)
local rows = cargoRows(
local teamPage = 'Team ' .. teamName
'Soldiers',
local head = teamNameLink(teamName)
'ASN,Surname,First_name,Middle_name,_pageName=pageName',
where,
8,
'Surname'
)
local links = linkList(rows, asn, pageTitle, 8)
local head = string.format('[[%s|%s]]', teamPage, label)
local cat = 'Category:' .. teamPage
local cat = 'Category:' .. teamPage
local links = {}
if where then
local rows = cargoRows(
'Soldiers',
'ASN,Surname,First_name,Middle_name,_pageName=pageName',
where,
8,
'Surname'
)
links = linkList(rows, asn, pageTitle, 8)
end
if #links > 0 then
if #links > 0 then
table.insert(
table.insert(
Line 2,427: Line 2,429:
)
)
else
else
-- MII and other non-Cargo teams: still surface the team page/category.
table.insert(
table.insert(
sections,
sections,
'<div class="soldier-related-block"><div class="soldier-related-label">Team</div>'
'<div class="soldier-related-block"><div class="soldier-related-label">Team '
.. '<div class="soldier-related-links">Also assigned to '
.. head
.. head
.. ' · [['
.. '</div><div class="soldier-related-links">[['
.. cat
.. cat
.. '|browse teammates]]</div></div>'
.. '|Browse soldiers listed on this team]]</div></div>'
)
)
end
end
end
end


if ipwGe ~= '' then
-- Same sources as the infobox Teams row: roster IPW, |teams=, research notes.
local num = mw.ustring.match(ipwGe, '(%d+)') or ipwGe
local teamNames = {}
addTeam('IPW ' .. num, 'Team IPW ' .. num, string.format('IPW_German="%s"', num))
local seenTeams = {}
local function addTeams(list)
for _, name in ipairs(list) do
appendUniqueTeamName(teamNames, seenTeams, name)
end
end
end
if ipwIt ~= '' then
addTeams(namesFromIpwGerman(parentArg(frame, 'ipw_ge')))
local num = mw.ustring.match(ipwIt, '(%d+)') or ipwIt
addTeams(namesFromIpwItalian(parentArg(frame, 'ipw_it')))
addTeam(
addTeams(namesFromTeamsParam(parentArg(frame, 'teams')))
'IPW Italian ' .. num,
addTeams(noteTeamNames(pageResearchNotesText()))
'Team IPW Italian ' .. num,
 
string.format('IPW_Italian="%s"', num)
for _, teamName in ipairs(teamNames) do
)
local where = nil
local geNum = mw.ustring.match(teamName, '^IPW (%d+)$')
local itCode = mw.ustring.match(teamName, '^IPW Italian (.+)$')
if geNum then
where = string.format('IPW_German="%s"', geNum)
elseif itCode then
where = string.format('IPW_Italian="%s"', itCode)
end
addTeamBlock(teamName, where)
end
end


Line 2,505: Line 2,519:
.. '<div class="soldier-related-heading">Same class and team</div>'
.. '<div class="soldier-related-heading">Same class and team</div>'
.. table.concat(sections, '\n')
.. table.concat(sections, '\n')
.. '<div class="soldier-related-note">These are other soldiers listed on the same class or team roster. '
.. 'People moved between teams; overlapping service dates are not always documented.</div>'
.. '</div>'
.. '</div>'
end
end


return p
return p