"ಮಾಡ್ಯೂಲ್:Citation/CS1/Date validation/sandbox" ಆವೃತ್ತಿಗಳ ಮಧ್ಯದ ಬದಲಾವಣೆಗಳು

ಸಂಪಾದನೆಯ ಸಾರಾಂಶವಿಲ್ಲ
if 12 < tonumber(month) or 1 > tonumber(month) or 1582 > tonumber(year) or 0 == tonumber(day) then return false; end -- month or day number not valid or not Gregorian calendar
anchor_year = year;
elseif mw.ustring.match(date_string, "^[%D%S]- +[1-9]%d?, +[1-9]%d%d%d%a?$") then -- month-initial: month day, year
month, day, anchor_year, year=mw.ustring.match(date_string, "([%D%S]-)%s*(%d%d?),%s*((%d%d%d%d?)%a?)");
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
elseif mw.ustring.match(date_string, "^[%D%S]- +[1-9]%d?[%-–][1-9]%d?, +[1-9]%d%d%d%a?$") then -- month-initial day range: month day–day, year; days are separated by endash
month, day, day2, anchor_year, year=mw.ustring.match(date_string, "([%D%S]-) +(%d%d?)[%-–](%d%d?), +((%d%d%d%d)%a?)");
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
month = get_month_number (month);
year2=year;
 
elseif mw.ustring.match(date_string, "^[1-9]%d? +[%D%S]- +[1-9]%d%d%d%a?$") then -- day-initial: day month year
day, month, anchor_year, year=mw.ustring.match(date_string, "(%d%d*)%s*([%D%S]-)%s+((%d%d%d%d?)%a?)");
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
 
elseif mw.ustring.match(date_string, "^[1-9]%d?[%-–][1-9]%d? +[%D%S]- +[1-9]%d%d%d%a?$") then -- day-range-initial: day–day month year; days are separated by endash
day, day2, month, anchor_year, year=mw.ustring.match(date_string, "(%d%d?)[%-–](%d%d?) +([%D%S]-) +((%d%d%d%d)%a?)");
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
month = get_month_number (month);
year2=year;
 
elseif mw.ustring.match(date_string, "^[1-9]%d? +[%D%S]- +[%-–] +[1-9]%d? +[%D%S]- +[1-9]%d%d%d%a?$") then -- day initial month-day-range: day month - day month year; uses spaced endash
day, month, day2, month2, anchor_year, year=mw.ustring.match(date_string, "(%d%d?) +([%D%S]-) +[%-–] +(%d%d?) +([%D%S]-) +((%d%d%d%d)%a?)");
if (not is_valid_month_season_range(month, month2)) or not is_valid_year(year) then return false; end -- date range order is left to right: earlier to later;
month = get_month_number (month); -- for metadata
year2=year;
 
elseif mw.ustring.match(date_string, "^[%D%S]- +[1-9]%d? [%-–] [%D%S]- +[1-9]%d?, +[1-9]%d%d%d%a?$") then -- month initial month-day-range: month day – month day, year; uses spaced endash
month, day, month2, day2, anchor_year, year=mw.ustring.match(date_string, "([%D%S]-) +(%d%d?) [%-–] ([%D%S]-) +(%d%d?), +((%d%d%d%d)%a?)");
if (not is_valid_month_season_range(month, month2)) or not is_valid_year(year) then return false; end
month = get_month_number (month); -- for metadata
year2=year;
 
elseif mw.ustring.match(date_string, "^[1-9]%d? +[%D%S]- +[1-9]%d%d%d [%-–] [1-9]%d? +[%D%S]- +[1-9]%d%d%d%a?$") then -- day initial month-day-year-range: day month year - day month year; uses spaced endash
day, month, year, day2, month2, anchor_year, year2=mw.ustring.match(date_string, "(%d%d?) +([%D%S]-) +(%d%d%d%d) [%-–] (%d%d?) +([%D%S]-) +((%d%d%d%d)%a?)");
if tonumber(year2) <= tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) or not is_valid_month_range_style(month, month2) then return false; end -- year2 no more than one year in the future; months same style
month2 = get_month_number (month2);
 
elseif mw.ustring.match(date_string, "^[%D%S]- +[1-9]%d?, +[1-9]%d%d%d [%-–] [%D%S]- +[1-9]%d?, +[1-9]%d%d%d%a?$") then -- month initial month-day-year-range: month day, year – month day, year; uses spaced endash
month, day, year, month2, day2, anchor_year, year2=mw.ustring.match(date_string, "([%D%S]-) +(%d%d?), +(%d%d%d%d) [%-–] ([%D%S]-) +(%d%d?), +((%d%d%d%d)%a?)");
if tonumber(year2) <= tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) or not is_valid_month_range_style(month, month2) then return false; end -- year2 no more than one year in the future; months same style
month2 = get_month_number (month2);
 
elseif mw.ustring.match(date_string, "^[%D%S]- +[1-9]%d%d%d[%-–]%d%d%a?$") then -- special case Winter/Summer year-year (YYYY-YY); year separated with unspaced endash
local century;
month, year, century, anchor_year, year2=mw.ustring.match(date_string, "([%D%S]-) +((%d%d)%d%d)[%-–]((%d%d)%a?)");
if 'Winter' ~= month and 'Summer' ~= month then return false end; -- 'month' can only be Winter or Summer
anchor_year=year..'–'..anchor_year; -- assemble anchor_year from both years
month = get_season_number (month);
 
elseif mw.ustring.match(date_string, "^[%D%S]- +[1-9]%d%d%d[%-–][1-9]%d%d%d%a?$") then -- special case Winter/Summer year-year; year separated with unspaced endash
month, year, anchor_year, year2=mw.ustring.match(date_string, "([%D%S]-) +(%d%d%d%d)[%-–]((%d%d%d%d)%a?)");
if 'Winter' ~= month and 'Summer' ~= month then return false end; -- 'month' can only be Winter or Summer
anchor_year=year..'–'..anchor_year; -- assemble anchor_year from both years
month = get_season_number (month); -- for metadata
 
elseif mw.ustring.match(date_string, "^[%D%S]- +[1-9]%d%d%d +[%-–] +[%D%S]- +[1-9]%d%d%d%a?$") then -- month/season year - month/season year; separated by spaced endash
month, year, month2, anchor_year, year2=mw.ustring.match(date_string, "([%D%S]-) +(%d%d%d%d) +[%-–] +([%D%S]-) +((%d%d%d%d)%a?)");
anchor_year=year..'–'..anchor_year; -- assemble anchor_year from both years
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
end
 
elseif mw.ustring.match(date_string, "^[%D%S]-[%-–][%D%S]- +[1-9]%d%d%d%a?$") then -- month/season range year; months separated by endash
month, month2, anchor_year, year=mw.ustring.match(date_string, "([%D%S]-)[%-–]([%D%S]-)%s*((%d%d%d%d)%a?)");
if (not is_valid_month_season_range(month, month2)) or (not is_valid_year(year)) then return false; end
if 0 ~= get_month_number(month) then -- determined to be a valid range so just check this one to know if month or season
year2=year;
elseif mw.ustring.match(date_string, "^[%D%S]- +%d%d%d%d%a?$") then -- month/season year or proper-name year
month, anchor_year, year=mw.ustring.match(date_string, "^([%D%S]-) +((%d%d%d%d)%a?)");
if not is_valid_year(year) then return false; end
if not is_valid_month_or_season (month) and 0 == is_proper_name (month) then return false; end
for k, v in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set(v) then -- if the parameter has a value
v = mw.ustring.gsub (v, '[೦-೯]', {['೦'] = '0', ['೧'] = 1, ['೨'] = 2, ['೩'] = 3, ['೪'] = 4, ['೫'] = 5, ['೬'] = 6, ['೭'] = 7, ['೮'] = 8, ['೯'] = '9'}cfg.date_names.local_digits);
if v:match("^c%. [1-9]%d%d%d?%a?$") then -- special case for c. year or with or without CITEREF disambiguator - only |date= and |year=
local year = v:match("c%. ([1-9]%d%d%d?)%a?"); -- get the year portion so it can be tested
೩೫

edits

"https://kn.wikipedia.org/wiki/ವಿಶೇಷ:MobileDiff/808273" ಇಂದ ಪಡೆಯಲ್ಪಟ್ಟಿದೆ