בדוקי עריכות אוטומטית, אינטערפעיס רעדאקטארן, אינטערפעיס אדמיניסטראַטאָרן, סיסאפן, מייבאים, מעדכנים, מייבא, אספקלריה רעדאקטארן
46,358
רעדאגירונגען
(פראבע) |
(אפדעיט) |
||
| שורה 49: | שורה 49: | ||
return result .. 'פטירה' | return result .. 'פטירה' | ||
end | end | ||
function getEventDetails(generalDate, hebDate, eventPlace, propDate, propPlace, age, usingWikidata, infoObj) | function getEventDetails(generalDate, hebDate, eventPlace, propDate, propPlace, age, usingWikidata, infoObj) | ||
entityId = infoObj.args.entityId | entityId = infoObj.args.entityId | ||
| שורה 92: | שורה 93: | ||
return formattedEvent, usingWikidata | return formattedEvent, usingWikidata | ||
end | |||
-- Split the comma-separated lists into tables and sort them | |||
local function splitString(inputstr, sep) | |||
local sep, fields = sep or ",", {} | |||
local pattern = string.format("([^%s]+)", sep) | |||
inputstr:gsub(pattern, function(c) fields[#fields + 1] = c end) | |||
return fields | |||
end | end | ||
function addMissingImage(infoObj, birthDate, deathDate, gender) | function addMissingImage(infoObj, birthDate, deathDate, gender) | ||
return | if infoObj.args.image ~= nil and #infoObj.args.image > 0 then return end -- there is already image | ||
local dateModule = require('Module:דאטום') | |||
-- Assuming you have defined deathDate and birthDate earlier | |||
local latestDate = deathDate or birthDate | |||
if latestDate == nil then return end | |||
-- Split the comma-separated lists and extract dates | |||
local dateList = splitString(latestDate:gsub(" או ", ","), ",") | |||
if #dateList == 0 then return end | |||
local iso8601DateList = {} | |||
local latestIsoDate = 0 | |||
local indexOfLatestIsoDate = 0 | |||
-- Convert the dates to ISO 8601 format | |||
for i, isoDate in ipairs(dateList) do | |||
local successOfIso8601DateList | |||
successOfIso8601DateList, iso8601DateList[i] = pcall(dateModule.parseStrDate, isoDate, 'TS') | |||
if (i == 1) then | |||
latestIsoDate = iso8601DateList[1] | |||
indexOfLatestIsoDate = 1 | |||
else | |||
if (latestIsoDate > iso8601DateList[i]) then | |||
latestIsoDate = iso8601DateList[i] | |||
indexOfLatestIsoDate = i | |||
end | |||
end | |||
end | |||
-- If needed, you can convert the latest ISO 8601 date back to a readable format | |||
latestDate = dateList[indexOfLatestIsoDate] | |||
local success, res = pcall(dateModule.parseDateRange, latestDate, 'raw') | |||
if success==false then return end -- there is no known VALID date | |||
local yearsEstimated = res/(60*60*24*365) | |||
if yearsEstimated>150 then return end | |||
local frame = mw.getCurrentFrame() | |||
infoObj.args.image = frame:expandTemplate{ title = 'אין תמונה', args = { gender, ['יישור'] = 'מרכז' } } | |||
end | end | ||
| שורה 274: | שורה 323: | ||
return infoObj:render() | return infoObj:render() | ||
end | end | ||
return { | return { | ||
רעדאגירונגען