Modul:Citation/CS1/Date validation: Forskelle mellem versioner

Content deleted Content added
m beskyttede "Modul:Citation/CS1/Date validation": Hyppigt brugt skabelon ([Redigér=Bloker uregistrerede brugere] (på ubestemt tid) [Flyt=Bloker uregistrerede brugere] (på ubestemt tid))
Fejlrettelser jf. mduldiskussionssiden
Linje 212:
 
local function is_valid_month_range_style (month1, month2)
elseifif 'May' == month1 or 'May'== month2 or 'maj'== month1 or 'maj'== month2 then
local len1 = month1:len();
return true;
local len2 = month2:len();
-- maj/May kan kombineres med både fulde og forkortede månedsnavne
if len1 == len2 then
return true; -- both months are short form so return true
elseif 'May' == month1 or 'May'== month2 or 'maj'== month1 or 'maj'== month2 then
return true; -- both months are long form so return true
elseif 3 == len1 or 3 == len2 or 4 == len1 or 4 == len2 then
return false; -- months are mixed form so return false
else
return (3 == month1:len() or '.' == string.sub(month1, 4, 4))
return true; -- both months are long form so return true
==
(3 == month2:len() or '.' == string.sub(month2, 4, 4))
-- De to boolske værdier der sammenlignes er om hhv. month1 og month2 er et forkortet navn (dvs. engelsk navn på 3 bogstaver, eller dansk navn med punktum))
end
end
Line 475 ⟶ 473:
day, month, day2, month2, anchor_year, year=mw.ustring.match(date_string, "(%d%d?) +(%a+) [%-–] (%d%d?) +(%a+) +((%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
month2 = get_month_number (month2);
year2=year;
 
elseif mw.ustring.match(date_string, "^[1-9]%d?%. +%a+%.? [%-–] [1-9]%d?%. +%a+%.? +[1-9]%d%d%d%a?$") then -- Dansk 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?)%. +(%a+%.?) [%-–] (%d%d?)%. +(%a+%.?) +((%d%d%d%d)%a?)");
if (not is_valid_month_season_range_da(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
month2 = get_month_number (month2);