יחידה:תאריך עברי: הבדלים בין גרסאות בדף
אין תקציר עריכה |
מ 197 גרסאות של הדף wikipedia:he:יחידה:תאריך_עברי יובאו |
||
| (35 גרסאות ביניים של 5 משתמשים אינן מוצגות) | |||
| שורה 23: | שורה 23: | ||
function find1(str, what, where) | function find1(str, what, where) | ||
return mw.ustring.find(str, what, where, true) or 0 | |||
end | end | ||
| שורה 79: | שורה 76: | ||
greg = same(greg .. " - ".. diffs .. "days") | greg = same(greg .. " - ".. diffs .. "days") | ||
checkcasp(greg) | checkcasp(greg) | ||
if makeformat then | |||
return frame:callParserFunction("#זמןמ:" .. makeformat, greg) | |||
end | |||
return format(greg) end | return format(greg) end | ||
count = count + 1 | count = count + 1 | ||
| שורה 138: | שורה 138: | ||
function same(gdate) | function same(gdate) | ||
return frame:callParserFunction("#זמןמ:d-m-Y", gdate) | return frame:callParserFunction("#זמןמ:d-m-Y", gdate) | ||
end | |||
function makeyear(gdate) | |||
local year = frame:callParserFunction("#זמןמ:Y", gdate) | |||
if tonumber(year) < 1000 and which | |||
then year = sub1(year, 2) | |||
end | |||
return year | |||
end | end | ||
function to(gdate) | function to(gdate) | ||
local year = makeyear(gdate) | |||
if frame.args["links"] == "yes" | if frame.args["links"] == "yes" | ||
then return "[[" .. frame:callParserFunction("#זמןמ:j בF", gdate) .. "]] [[" | then return "[[" .. frame:callParserFunction("#זמןמ:j בF", gdate) .. "]] [[" | ||
.. | .. year .. "]]" end | ||
return frame:callParserFunction("#זמןמ:j בF | return frame:callParserFunction("#זמןמ:j בF", gdate) .. " " .. year | ||
end | end | ||
function tomonth(gdate) | function tomonth(gdate) | ||
local year = makeyear(gdate) | |||
if frame.args["links"] == "yes" | if frame.args["links"] == "yes" | ||
then return "[[" .. frame:callParserFunction("#זמןמ:F", gdate) .. "]] [[" | then return "[[" .. frame:callParserFunction("#זמןמ:F", gdate) .. "]] [[" | ||
.. | .. year .. "]]" end | ||
return frame:callParserFunction("#זמןמ:F | return frame:callParserFunction("#זמןמ:F", gdate) .. " " .. year | ||
end | end | ||
| שורה 161: | שורה 171: | ||
function toyear(gdate) | function toyear(gdate) | ||
local year = makeyear(gdate) | |||
if frame.args["links"] == "yes" | if frame.args["links"] == "yes" | ||
then return "[[" .. | then return "[[" .. year .. "]]" end | ||
return | return year | ||
end | end | ||
| שורה 341: | שורה 352: | ||
function fromhebrew(f) | function fromhebrew(f) | ||
which = true | which = true | ||
return fromhebrewandverify(f) | |||
end | |||
function fromhebrewformat(f) | |||
which = true | |||
makeformat = f.args["format"] | |||
return fromhebrewandverify(f) | return fromhebrewandverify(f) | ||
end | end | ||
| שורה 346: | שורה 363: | ||
function verify(f) | function verify(f) | ||
frame = f | frame = f | ||
which = false | which = false | ||
local success, res = pcall(pick1, frame.args[1], frame.args[2], "[[קטגוריה:חוסר מתאם בין תאריך עברי לתאריך לועזי]]") | local success, res = pcall(pick1, frame.args[1], frame.args[2], "[[קטגוריה:חוסר מתאם בין תאריך עברי לתאריך לועזי]]") | ||
| שורה 479: | שורה 495: | ||
-- .. frame.args["type"] .. " לועזי מדויק]]" end | -- .. frame.args["type"] .. " לועזי מדויק]]" end | ||
return "" end | return "" end | ||
if hsuccess | if wsuccess and hsuccess | ||
then if ht == "dmy" then return hdw | then if wt == "dmy" then return wdate | ||
elseif wt == " | elseif ht == "dmy" then return hdw | ||
elseif wt == "my" then return wdate | |||
elseif ht == "my" then return hdw | elseif ht == "my" then return hdw | ||
elseif wt == " | elseif wt == "y" then return wdate | ||
else return hdw end | |||
elseif wsuccess then return wdate | |||
elseif hsuccess then return hdw | elseif hsuccess then return hdw | ||
elseif | elseif wt == "about" then return wdate | ||
else return hdate end | |||
else return | |||
end | end | ||
| שורה 500: | שורה 516: | ||
function pick(f) | function pick(f) | ||
frame = f | frame = f | ||
local hebrew = frame.args["hebrew"] | |||
local success, res = pcall(pick1, | local world = frame.args["world"] | ||
local habout = false | |||
local wabout = false | |||
if frame:expandTemplate({title = "גיל לערכי אישים/מקורב", args = {str = hebrew}}) ~= "" | |||
then hebrew = "" | |||
habout = true end | |||
if frame:expandTemplate({title = "גיל לערכי אישים/מקורב", args = {str = world}}) ~= "" | |||
then world = "" | |||
wabout = true end | |||
local success, res = pcall(pick1, hebrew, world) | |||
if success | if success | ||
then return res | then if habout and world == "" | ||
then return frame.args["hebrew"] end | |||
if wabout and hebrew == "" | |||
then return frame.args["world"] end | |||
return res | |||
elseif frame.args["error"] == nil | elseif frame.args["error"] == nil | ||
then return aserror(res) end | then return aserror(res) end | ||
| שורה 540: | שורה 569: | ||
then return ans | then return ans | ||
else return noans end | else return noans end | ||
end | end | ||
| שורה 586: | שורה 611: | ||
end | end | ||
return {fromhebrew = fromhebrew, tohebrew = tohebrew, verify = verify, pick = pick, samedate = samedate, | |||
fromhebrewformat = fromhebrewformat} | |||
return {fromhebrew = fromhebrew, tohebrew = tohebrew, verify = verify, pick = pick, samedate = samedate, | |||