Module:Soldier: Difference between revisions
Wikipedia-style awards grid under ribbon rows |
Military sidebar: years/battles/ribbons + branch emblems |
||
| Line 1,215: | Line 1,215: | ||
if raw == '' then | if raw == '' then | ||
return {} | return {} | ||
end | |||
-- Prefer @@ row separator (safe inside {{Soldier}}); also accept legacy ||| | |||
local sep = '@@' | |||
if not mw.ustring.find(raw, '@@', 1, true) and mw.ustring.find(raw, '|||', 1, true) then | |||
sep = '|||' | |||
end | end | ||
local rows = {} | local rows = {} | ||
for row in mw.text.gsplit(raw, | for row in mw.text.gsplit(raw, sep, true) do | ||
row = trim(row) | row = trim(row) | ||
if row ~= '' then | if row ~= '' then | ||
| Line 1,223: | Line 1,228: | ||
for cell in mw.text.gsplit(row, ';;', true) do | for cell in mw.text.gsplit(row, ';;', true) do | ||
cell = trim(cell) | cell = trim(cell) | ||
-- Unescape {{!}} used if a label ever needed a pipe | |||
cell = mw.ustring.gsub(cell, '{{!}}', '|') | |||
if cell ~= '' then | if cell ~= '' then | ||
table.insert(cells, cell) | table.insert(cells, cell) | ||