יחידה:גיל לערכי אישים: הבדלים בין גרסאות בדף
מאין תקציר עריכה |
מ הפרדה לפונקציה |
||
| שורה 56: | שורה 56: | ||
end | end | ||
function | function ageCalcFromFrame(frame) | ||
local args = Arguments.getArgs(frame, { ['trim'] = true, ['removeBlanks'] = true }) | local args = Arguments.getArgs(frame, { ['trim'] = true, ['removeBlanks'] = true }) | ||
local age_string = args['מציין'] | --local age_string = args['מציין'] | ||
local BirthDateStr = args['תאריך לידה'] | local BirthDateStr = args['תאריך לידה'] | ||
local DeathDateStr = args['תאריך פטירה'] | local DeathDateStr = args['תאריך פטירה'] | ||
| שורה 65: | שורה 65: | ||
local Brackets = args['סוגריים'] | local Brackets = args['סוגריים'] | ||
local ApproxDate = args['מקורב'] | local ApproxDate = args['מקורב'] | ||
DisplayForAlive = (DisplayForAlive=='כן') | DisplayForAlive = (DisplayForAlive=='כן') | ||
DisplayForDead = (DisplayForDead=='כן') | DisplayForDead = (DisplayForDead=='כן') | ||
Brackets = (Brackets~='לא') | Brackets = (Brackets~='לא') | ||
return ageCalc(BirthDateStr, DeathDateStr, DisplayForAlive, DisplayForDead, Brackets, ApproxDate) | |||
end | |||
function ageCalc(BirthDateStr, DeathDateStr, DisplayForAlive, DisplayForDead, Brackets, ApproxDate) | |||
local frame = mw.getCurrentFrame() | |||
local warnings = {} | |||
local dateRangeStr | |||
local wikidataBirth, wikidataDeath | |||
if BirthDateStr == '' then BirthDateStr = nil end | if BirthDateStr == '' then BirthDateStr = nil end | ||
if DeathDateStr == '' then DeathDateStr = nil end | if DeathDateStr == '' then DeathDateStr = nil end | ||
| שורה 115: | שורה 120: | ||
else | else | ||
if (age_string) then | --if (age_string) then | ||
-- prefix = age_string..' ' | |||
else | --else | ||
prefix = frame:expandTemplate{ title = 'לפי מגדר/בדוק', args = { 'בן ', 'בת ' } } | prefix = frame:expandTemplate{ title = 'לפי מגדר/בדוק', args = { 'בן ', 'בת ' } } | ||
end | --end | ||
end | end | ||
| שורה 168: | שורה 173: | ||
return { | return { | ||
['גיל'] = ageCalc | ['גיל'] = ageCalcFromFrame, | ||
ageCalc = ageCalc | |||
} | } | ||