Module:Soldier: Difference between revisions
Hide certificate=NG (non-graduate marker) in infobox |
Opening summary: prefer full birth/death dates (Wikipedia style) |
||
| Line 1,385: | Line 1,385: | ||
local function lifespan(birth, death) | local function lifespan(birth, death) | ||
birth = | birth = trim(birth or '') | ||
death = | death = trim(death or '') | ||
if birth ~= '' and death ~= '' then | if birth ~= '' and death ~= '' then | ||
return ' (' .. birth .. '–' .. death .. ')' | return ' (' .. birth .. ' – ' .. death .. ')' | ||
end | end | ||
if birth ~= '' then | if birth ~= '' then | ||
| Line 1,397: | Line 1,397: | ||
end | end | ||
return '' | return '' | ||
end | |||
--- Prefer full birth/death dates (Wikipedia style); fall back to years. | |||
local function lifespanFromArgs(getArg) | |||
local birth = prettyProse(getArg('birth_date')) | |||
local death = prettyProse(getArg('death_date')) | |||
if birth == '' then | |||
birth = yearOnly(getArg('birth_year')) | |||
end | |||
if death == '' then | |||
death = yearOnly(getArg('death_year')) | |||
end | |||
return lifespan(birth, death) | |||
end | end | ||
| Line 1,473: | Line 1,486: | ||
"'''%s'''%s was a %s%s.", | "'''%s'''%s was a %s%s.", | ||
name, | name, | ||
lifespanFromArgs(getArg), | |||
role, | role, | ||
trained | trained | ||