מייבאים כמותיים, בדוקי עריכות אוטומטית, ביוראקראטן, אינטערפעיס רעדאקטארן, emailconfirmed, אינטערפעיס אדמיניסטראַטאָרן, מנטרים, סיסאפן, צוות טכני, מייבאים, מעדכנים, אספקלריה רעדאקטארן
102,362
רעדאגירונגען
(צוריקדריי צו ווערסיע 211830 פון 06:04, מערץ 10, 2023 דורך תנא קמא. קוקט אויס די לעצטע בעסטע ווערסיע) צייכנס: מאנועל צוריקשטעל צוריקגעשטעלט |
צייכן: צוריקדריי |
||
| שורה 261: | שורה 261: | ||
return year, month, day | return year, month, day | ||
end | |||
--[[ get month name and day (as numeric string), in either order, and return their numbers as day, month | |||
if optional parameter 'reverse' is true, return month first | |||
]]-- | |||
local function monthDay(dateTable, reverse) | |||
local months = { | |||
['יאנואר']= 1, | |||
['פעברואר']= 2, | |||
['מערץ']= 3, | |||
['אפריל']= 4, | |||
['מאי']= 5, | |||
['יוני']= 6, | |||
['יולי']= 7, | |||
['אויגוסט']= 8, | |||
['סעפטעמבער']= 9, | |||
['אקטאבער']= 10, | |||
['נאוועמבער']= 11, | |||
['דעצעמבער']= 12 | |||
} | |||
local month = nil | |||
local day = nil | |||
for _, value in ipairs(dateTable) do | |||
if months[value] then | |||
month = months[value] | |||
else | |||
day = tonumber(value) | |||
end | |||
end | |||
if reverse then | |||
return month, day | |||
else | |||
return day, month | |||
end | |||
end | end | ||
| שורה 430: | שורה 466: | ||
]] | ]] | ||
function Date.newFromWikitext( wikitext ) | function Date.newFromWikitext( wikitext ) | ||
local calendar = nil | local calendar = nil | ||
if mw.ustring.find( wikitext, '<small>%(%[%[יוליאנישער קאלענדאר%|יוליאניש%]%]%)</small>' ) then | if mw.ustring.find( wikitext, '<small>%(%[%[יוליאנישער קאלענדאר%|יוליאניש%]%]%)</small>' ) then | ||
| שורה 459: | שורה 481: | ||
-- BC to minus | -- BC to minus | ||
wikitext = mw.ustring.gsub( wikitext, "([0-9]+) לפנה[\"״]ס" , "-%1") | wikitext = mw.ustring.gsub( wikitext, "([0-9]+) לפנה[\"״]ס" , "-%1") | ||
if mw.ustring.match(wikitext, '^המאה ה[־-]%d+$') then | if mw.ustring.match(wikitext, '^המאה ה[־-]%d+$') then | ||
| שורה 468: | שורה 486: | ||
return Date.new( { year=tonumber(yearStr)*100, month=0, day=0, precision= Date.PRECISION.YEAR100 } ) | return Date.new( { year=tonumber(yearStr)*100, month=0, day=0, precision= Date.PRECISION.YEAR100 } ) | ||
end | end | ||
local parts = mw.text.split(mw.text.trim(wikitext),' ') | local parts = mw.text.split(mw.text.trim(wikitext),' ') | ||
| שורה 476: | שורה 493: | ||
if #parts==3 then -- DMY date | if #parts==3 then -- DMY date | ||
definition.year = tonumber(parts[3]) | definition.year = tonumber(parts[3]) | ||
definition.month = | definition.day, definition.month = monthDay({parts[1], parts[2]}) | ||
assert(definition.year, "Could not recognize year") | assert(definition.year, "Could not recognize year") | ||
assert(definition.month<13 and definition.month>0, "Could not recognize month number") | assert(definition.month<13 and definition.month>0, "Could not recognize month number") | ||
| שורה 483: | שורה 499: | ||
definition.precision = Date.PRECISION.DAY | definition.precision = Date.PRECISION.DAY | ||
elseif #parts==2 then -- MY date | elseif #parts==2 then -- MY date | ||
definition. | definition.month, definition.year = monthDay(parts, true) | ||
definition.precision = Date.PRECISION.MONTH | definition.precision = Date.PRECISION.MONTH | ||
assert(definition.year<1e7, "Could not recognize year") | assert(definition.year<1e7, "Could not recognize year") | ||
רעדאגירונגען