Military sidebar: years/battles/ribbons + branch emblems
Show eight-week class dates on Camp Ritchie infobox row
Line 779: Line 779:


local function classLinkList(raw, withPrefix)
local function classLinkList(raw, withPrefix)
local ClassDates = require('Module:ClassDates')
local out = {}
local out = {}
for part in mw.text.gsplit(raw, ';', true) do
for part in mw.text.gsplit(raw, ';', true) do
part = trim(part)
part = trim(part)
if part ~= '' then
if part ~= '' then
local info = ClassDates.lookup(part)
local dates = info and info.dates or ''
if withPrefix then
if withPrefix then
table.insert(out, string.format('[[Class %s]]', part))
if dates ~= '' then
table.insert(out, string.format('[[Class %s]] (%s)', part, dates))
else
table.insert(out, string.format('[[Class %s]]', part))
end
else
else
table.insert(out, string.format('[[Class %s|%s]]', part, part))
if dates ~= '' then
table.insert(out, string.format('[[Class %s|%s]] (%s)', part, part, dates))
else
table.insert(out, string.format('[[Class %s|%s]]', part, part))
end
end
end
end
end