יחידה:תאריך: הבדלים בין גרסאות בדף
מאין תקציר עריכה |
מאין תקציר עריכה |
||
| שורה 444: | שורה 444: | ||
['דצמבר']= 12 | ['דצמבר']= 12 | ||
} | } | ||
local calendar = nil | |||
if mw.ustring.find( '16 באפריל 1899 <small>([[הלוח היוליאני|יוליאני]])</small>', '<small>%(%[%[הלוח היוליאני%|יוליאני%]%]%)</small>' ) then | |||
calendar = Date.CALENDAR.JULIAN | |||
wikitext = mw.ustring.gsub( wikitext, "<small>%(%[%[הלוח היוליאני%|יוליאני%]%]%)</small>", "" ) | |||
end | |||
-- Remove instances of [ and ] | -- Remove instances of [ and ] | ||
wikitext = mw.ustring.gsub( wikitext, "[%[%]]", "" ) | wikitext = mw.ustring.gsub( wikitext, "[%[%]]", "" ) | ||
| שורה 454: | שורה 458: | ||
mw.log('תאריך' .. ":" .. wikitext) | mw.log('תאריך' .. ":" .. 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 | for a in pairs(months) do | ||
| שורה 461: | שורה 465: | ||
-- if there are alphabet chars return nil (unexpected character) | -- if there are alphabet chars return nil (unexpected character) | ||
assert(not mw.ustring.find(wikitext, '%a'), "Unexpected format") | assert(not mw.ustring.find(wikitext, '%a'), "Unexpected format") | ||
local parts = mw.text.split(mw.text.trim(wikitext),' ') | local parts = mw.text.split(mw.text.trim(wikitext),' ') | ||
local definition = {} | local definition = {} | ||
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]) | ||