"మాడ్యూల్:Citation/CS1/Date validation" కూర్పుల మధ్య తేడాలు

Synch from sandbox;
(Synch from sandbox;)
(Synch from sandbox;)
end
end
 
 
--[[--------------------------< G E T _ M O N T H _ N U M B E R >----------------------------------------------
0; -- misspelled, improper case, or not a month name
end
 
 
--[[--------------------------< I S _ V A L I D _ E M B A R G O _ D A T E >------------------------------------
 
returns true and date value if that value has proper dmy, mdy, ymd format.
 
returns false and 9999 when date value is not proper format; assumes that when |embargo= is set, the editor
intended to embargo a pmc but |embargo does not hold a single date.
 
]]
 
local function is_valid_embargo_date (v)
if v:match ('^%d%d%d%d%-%d%d%-%d%d$') or -- ymd
v:match ('^%d%d?%s+%a+%s+%d%d%d%d$') or -- dmy
v:match ('^%a+%s+%d%d?%s*,%s*%d%d%d%d$') then -- mdy
return true, v;
end
return false, '9999'; -- if here not good date so return false and set embargo date to long time in future
end
 
 
--[[--------------------------< G E T _ S E A S O N _ N U M B E R >--------------------------------------------
local anchor_year; -- will return as nil if the date being tested is not |date=
local COinS_date; -- will return as nil if the date being tested is not |date=
local embargo_date = '9999'; -- if good dmy, mdy, ymd date then holds original value else 9999
local error_message = "";
local good_date = false;
good_date, anchor_year, COinS_date = check_date (v, tCOinS_date); -- go test the date
end
elseif 'access-date'==k then -- if the parameter is |access-date=
good_date = check_date (v); -- go test the date
if true == good_date then -- if the date is a valid date
good_date = is_valid_accessdate (v); -- is Wikipedia start date < accessdate < tomorrow's date?
end
elseif 'embargo'==k then -- if the parameter is |embargo=
good_date = check_date (v); -- go test the date
if true == good_date then -- if the date is a valid date
good_date, embargo_date = is_valid_embargo_date (v); -- is |embargo= date a single dmy, mdy, or ymd formatted date? yes:returns embargo; no: returns 9999
end
else -- any other date-holding parameter
end
end
return anchor_year, embargo_date, error_message; -- and done
end
 
"https://te.wikipedia.org/wiki/ప్రత్యేక:MobileDiff/1993326" నుండి వెలికితీశారు