בדוקי עריכות אוטומטית, אינטערפעיס רעדאקטארן, אינטערפעיס אדמיניסטראַטאָרן, סיסאפן, מייבאים, מעדכנים, מייבא, אספקלריה רעדאקטארן
46,382
רעדאגירונגען
(אפדעיט) צייכן: צוריקגעשטעלט |
(צוריקדריי צו ווערסיע 211830 פון 06:04, מערץ 10, 2023 דורך תנא קמא. קוקט אויס די לעצטע בעסטע ווערסיע) צייכנס: מאנועל צוריקשטעל צוריקגעשטעלט |
||
| שורה 261: | שורה 261: | ||
return year, month, day | return year, month, day | ||
end | end | ||
| שורה 458: | שורה 422: | ||
return Date.new( definition ) | return Date.new( definition ) | ||
end | end | ||
| שורה 478: | שורה 430: | ||
]] | ]] | ||
function Date.newFromWikitext( wikitext ) | function Date.newFromWikitext( wikitext ) | ||
local months = { | |||
['יאנואר']= 1, | |||
['פעברואר']= 2, | |||
['מערץ']= 3, | |||
['אפריל']= 4, | |||
['מאי']= 5, | |||
['יוני']= 6, | |||
['יולי']= 7, | |||
['אויגוסט']= 8, | |||
['סעפטעמבער']= 9, | |||
['אקטאבער']= 10, | |||
['נאוועמבער']= 11, | |||
['דעצעמבער']= 12 | |||
} | |||
local calendar = nil | local calendar = nil | ||
if mw.ustring.find( wikitext, '<small>%(%[%[יוליאנישער קאלענדאר%|יוליאניש%]%]%)</small>' ) then | if mw.ustring.find( wikitext, '<small>%(%[%[יוליאנישער קאלענדאר%|יוליאניש%]%]%)</small>' ) then | ||
| שורה 488: | שורה 454: | ||
-- Remove footnotes & directionality markers | -- Remove footnotes & directionality markers | ||
wikitext = mw.text.killMarkers( wikitext ) | wikitext = mw.text.killMarkers( wikitext ) | ||
wikitext = mw.ustring.gsub(wikitext, "‏", "") | wikitext = mw.ustring.gsub(wikitext, "‏","") | ||
wikitext = mw.ustring.gsub(wikitext, "‎", "") | wikitext = mw.ustring.gsub(wikitext, "‎","") | ||
-- BC to minus | -- BC to minus | ||
wikitext = mw.ustring.gsub( wikitext, "([0-9]+) לפנה[\"״]ס" , "-%1") | wikitext = mw.ustring.gsub( wikitext, "([0-9]+) לפנה[\"״]ס" , "-%1") | ||
for a in pairs(months) do | |||
wikitext = mw.ustring.gsub(wikitext, ' ?ב?'..a, ' ' .. months[a]) | |||
end | |||
if mw.ustring.match(wikitext, '^המאה ה[־-]%d+$') then | if mw.ustring.match(wikitext, '^המאה ה[־-]%d+$') then | ||
| שורה 499: | שורה 468: | ||
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 | ||
-- if there are alphabet chars return nil (unexpected character) | |||
assert(not mw.ustring.find(wikitext, '%a'), "Unexpected format") | |||
local parts = mw.text.split(mw.text.trim(wikitext),' ') | |||
local definition = {} | local definition = {} | ||
definition.calendar = calendar | definition.calendar = calendar | ||
if #parts==3 then -- DMY date | if #parts==3 then -- DMY date | ||
definition.year = tonumber(parts[3]) | definition.year = tonumber(parts[3]) | ||
definition.month = tonumber(parts[2]) | |||
definition.day = tonumber(parts[1]) | |||
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") | ||
| שורה 513: | שורה 483: | ||
definition.precision = Date.PRECISION.DAY | definition.precision = Date.PRECISION.DAY | ||
elseif #parts==2 then -- MY date | elseif #parts==2 then -- MY date | ||
definition. | definition.year = tonumber(parts[2]) | ||
definition.month = tonumber(parts[1]) | |||
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") | ||
| שורה 832: | שורה 803: | ||
-- remove footnotes | -- remove footnotes | ||
dateRangeStr = mw.text.killMarkers(dateRangeStr) | dateRangeStr = mw.text.killMarkers(dateRangeStr) | ||
dateRangeStr = mw.ustring.gsub(dateRangeStr, "‏", "") | dateRangeStr = mw.ustring.gsub(dateRangeStr, "‏","") | ||
local outputPrefix = '' | local outputPrefix = '' | ||
| שורה 842: | שורה 812: | ||
local t1 = Date.newFromWikitext( parts[1] ) | local t1 = Date.newFromWikitext( parts[1] ) | ||
local t2 | local t2 | ||
local useCurrent = #parts<2 or (parts[2] == 'היום' or parts[2]=='הווה | local useCurrent = #parts<2 or (parts[2] == 'היום' or parts[2]=='הווה') | ||
if not useCurrent then | if not useCurrent then | ||
| שורה 980: | שורה 950: | ||
end | end | ||
str = mw.ustring.gsub(str," שנה", "") | str = mw.ustring.gsub(str," שנה", "") | ||
if tonumber(str) > 0 and | |||
tonumber(parseDateRange(frame.args[1], "raw", inclusive)) < 0 then | |||
str = -1 * str | str = -1 * str | ||
end | end | ||
רעדאגירונגען