模块:Citation/CS1/Date validation:修订间差异

imported>Liangent
无编辑摘要
imported>Liangent
无编辑摘要
第4行: 第4行:
-- returns a number according to the month in a date: 1 for January, etc.  Capitalization and spelling must be correct. If not a valid month, returns 0
-- returns a number according to the month in a date: 1 for January, etc.  Capitalization and spelling must be correct. If not a valid month, returns 0
function get_month_number (month)
function get_month_number (month)
local long_months = {['1月']=1, ['2月']=2, ['3月']=3, ['4月']=4, ['5月']=5, ['6月']=6, ['7月']=7, ['8月']=8, ['9月']=9, ['10月']=10, ['11月']=11, ['12月']=12};
local long_months = {['January']=1, ['February']=2, ['March']=3, ['April']=4, ['May']=5, ['June']=6, ['July']=7, ['August']=8, ['September']=9, ['October']=10, ['November']=11, ['December']=12};
local short_months = {['Jan']=1, ['Feb']=2, ['Mar']=3, ['Apr']=4, ['May']=5, ['Jun']=6, ['Jul']=7, ['Aug']=8, ['Sep']=9, ['Oct']=10, ['Nov']=11, ['Dec']=12};
local short_months = {['Jan']=1, ['Feb']=2, ['Mar']=3, ['Apr']=4, ['May']=5, ['Jun']=6, ['Jul']=7, ['Aug']=8, ['Sep']=9, ['Oct']=10, ['Nov']=11, ['Dec']=12};
local zh_months = {['1月']=1, ['2月']=2, ['3月']=3, ['4月']=4, ['5月']=5, ['6月']=6, ['7月']=7, ['8月']=8, ['9月']=9, ['10月']=10, ['11月']=11, ['12月']=12};
local temp;
local temp;
temp=long_months[month];
temp=long_months[month];
第11行: 第12行:
temp=short_months[month];
temp=short_months[month];
if temp then return temp; end -- if month is the short-form name
if temp then return temp; end -- if month is the short-form name
temp=zh_months[month];
if temp then return temp; end -- if month is in Chinese
return 0; -- misspelled, improper case, or not a month name
return 0; -- misspelled, improper case, or not a month name
end
end