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

check date function from mlwiki
(fix for small letter months to be accepted)
(check date function from mlwiki)
year, month, day=string.match(date_string, "(%d%d%d%d)%-(%d%d)%-(%d%d)");
month=tonumber(month);
if 12 < month or 1 > month or 1583 > tonumber(year) then return false; end -- month number not valid or not Gregorian calendar
anchor_year = year;
 
elseif date_string:match("^%d%d%d%d%-%d%d%-%d%d %d%d:%d%d:%d%d$") then -- ISO Date Format
local hh=0;
local mi=0;
local ss=0;
year, month, day, hh, mi, ss=string.match(date_string, "(%d%d%d%d)%-(%d%d)%-(%d%d)% (%d%d)%:(%d%d)%:(%d%d)");
month=tonumber(month);
if 12 < month or 1 > month or 1583 > tonumber(year) then return false; end -- month number not valid or not Gregorian calendar
anchor_year = year;
 
elseif mw.ustring.match(date_string, "^%d%d? [%C%D%P%W]+ %d%d%d%d?$") then -- dd മാസം year
day, month, year=mw.ustring.match(date_string, "(%d%d?)% ([%C%D%P%W]+) (%d%d%d%d?)");
month=get_month_number(month);
if 12 < month or 1 > month or 1583 > tonumber(year) then return false; end -- month number not valid or not Gregorian calendar
anchor_year = year;
 
elseif mw.ustring.match(date_string, "^[%C%D%P%W]+ %d%d?, %d%d%d%d?$") then -- മാസം dd, year
month, day, year=mw.ustring.match(date_string, "([%C%D%P%W]+) (%d%d?)%, (%d%d%d%d?)");
month=get_month_number(month);
if 12 < month or 1 > month or 1583 > tonumber(year) then return false; end -- month number not valid or not Gregorian calendar
anchor_year = year;
 
elseif mw.ustring.match(date_string, "^%d%d%d%d? [%C%D%P%W]+ %d%d?$") then -- year മാസം dd
year, month, day=mw.ustring.match(date_string, "(%d%d%d%d?) ([%C%D%P%W]+) (%d%d?)");
month=get_month_number(month);
if 12 < month or 1 > month or 1583 > tonumber(year) then return false; end -- month number not valid or not Gregorian calendar
anchor_year = year;
end
 
--[[
--[[--------------------------< D A T E S >--------------------------------------------------------------------
 
Cycle the date-holding parameters in passed table date_parameters_list through check_date() to check compliance with MOS:DATE. For all valid dates, check_date() returns
true. The |date= parameter test is unique, it is the only date holding parameter from which values for anchor_year (used in CITEREF identifiers) and COinS_date (used in
Unlike most error messages created in this module, only one error message is created by this function. Because all of the date holding parameters are processed serially,
a single error message is created as the dates are tested.
 
]]
 
end
elseif 'date'==k then -- if the parameter is |date=
if v:match("^n%.d%.%a?") then -- if |date=n.d. with or without a CITEREF disambiguator
good_date, anchor_year, COinS_date = true, v:match("((n%.d%.)%a?)"); --"n.d."; no error when date parameter is set to no date
elseif v:match("^nd%a?$") then -- if |date=nd with or without a CITEREF disambiguator
good_date, anchor_year, COinS_date = true, v:match("((nd)%a?)"); --"nd"; no error when date parameter is set to no date
else
"https://te.wikipedia.org/wiki/ప్రత్యేక:MobileDiff/1443946" నుండి వెలికితీశారు