模块:Citation/CS1/Date validation:修订间差异
imported>Liangent 无编辑摘要 |
imported>Liangent 无编辑摘要 |
||
| 第240行: | 第240行: | ||
-- LOCAL | -- LOCAL | ||
elseif | elseif mw.ustring.match(date_string, "^[1-9]%d%d%d年[1-9]%d?月[1-9]%d?日$") then -- zh: year month day | ||
year, month, day= | year, month, day=mw.ustring.match(date_string, "(%d%d%d%d)年(%d%d*月)(%d%d*)日"); | ||
month = get_month_number (month); | month = get_month_number (month); | ||
if 0 == month then return false; end | if 0 == month then return false; end | ||
| 第269行: | 第269行: | ||
if false == result then return false; end | if false == result then return false; end | ||
-- if here, then date_string is valid; get coins_date from date_string (leave CITEREF disambiguator) ... | -- if here, then date_string is valid; get coins_date from date_string (leave CITEREF disambiguator) ... | ||
coins_date= | coins_date=mw.ustring.match(date_string, "^(.+%d)%a?$"); -- last character of valid disambiguatable date is always a digit -- LOCAL | ||
coins_date= mw.ustring.gsub(coins_date, "–", "-" ); -- ... and replace any ndash with a hyphen | coins_date= mw.ustring.gsub(coins_date, "–", "-" ); -- ... and replace any ndash with a hyphen | ||