Module:Mourning
Appearance
local p = {}
local function parseDeathDate(raw)
if not raw or raw == "" then
return nil
end
local m, d = raw:match("{{%s*[Dd]eath date and age%s*|%s*%d+%s*|%s*(%d+)%s*|%s*(%d+)")
if m and d then
return tonumber(m), tonumber(d)
end
m, d = raw:match("{{%s*[Dd]eath date%s*|%s*%d+%s*|%s*(%d+)%s*|%s*(%d+)")
if m and d then
return tonumber(m), tonumber(d)
end
return nil
end
function p.main(frame)
local rawDeathDate = frame.args.death_date
local month, day = parseDeathDate(rawDeathDate)
if not month or not day then
return ""
end
local utcNow = os.date("!*t")
if month == utcNow.month and day == utcNow.day then
return frame:expandTemplate{
title = 'Top icon',
args = {
imagename = 'Black Ribbon.svg',
description = 'This person died on this day.',
id = 'z'
}
}
end
return ""
end
return p