-- Find the date of birth/death from -- Doesn't preserve AD, BC, ca. etc..
local p =
function p.getcategory(frame)
local pframe = frame:getParent local args = pframe.args -- Load the page t = mw.title.getCurrentTitle pagetext = t:getContent if pagetext
-- Remove false positives pagetext = mw.ustring.gsub(mw.ustring.gsub(pagetext, "", ""), ".-", "")
-- Scrape for the Category and find date local birthcheck = mw.ustring.match(pagetext, "%[%[%s-[Cc]ategory:%s-%d+%.?%d*%s-births%s-%]%]") if birthcheck ~= nil then birthcat = mw.ustring.match(birthcheck, "%d+%.?%d*") else birthcat = "Unknown" end
local deathcheck = mw.ustring.match(pagetext, "%[%[%s-[Cc]ategory:%s-%d+%.?%d*%s-deaths%s-%]%]") if deathcheck ~= nil then deathcat = mw.ustring.match(deathcheck, "%d+%.?%d*") else deathcat = "Unknown" end
return birthcat .. "-" .. deathcat end
return p