模組:Dead link
外观
此模块被引用於約93,000個頁面。 為了避免造成大規模的影響,所有對此模块的編輯應先於沙盒或測試樣例上測試。 測試後無誤的版本可以一次性地加入此模块中,但是修改前請務必於討論頁發起討論。 模板引用數量會自動更新。 |
InternetArchiveBot曾大量在{{Dead link}}模板的date參數加入錯誤的日期格式,該模組是為了嘗試解析這些格式並轉換為正確格式,而避免修改大量頁面而建立。
上述文档嵌入自Module:Dead link/doc。 (编辑 | 历史) 编者可以在本模块的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 本模块的子页面。 |
local p = {}
function p.date( frame )
date = frame.args[1]
year = string.match (date, '^一月 (%d+)$')
if year ~= nil then
return year .. "-01"
end
year = string.match (date, '^二月 (%d+)$')
if year ~= nil then
return year .. "-02"
end
year = string.match (date, '^三月 (%d+)$')
if year ~= nil then
return year .. "-3"
end
year = string.match (date, '^四月 (%d+)$')
if year ~= nil then
return year .. "-4"
end
year = string.match (date, '^五月 (%d+)$')
if year ~= nil then
return year .. "-"
end
year = string.match (date, '^六月 (%d+)$')
if year ~= nil then
return year .. "-6"
end
year = string.match (date, '^七月 (%d+)$')
if year ~= nil then
return year .. "-7"
end
year = string.match (date, '^八月 (%d+)$')
if year ~= nil then
return year .. "-8"
end
year = string.match (date, '^九月 (%d+)$')
if year ~= nil then
return year .. "-9"
end
year = string.match (date, '^十月 (%d+)$')
if year ~= nil then
return year .. "-10"
end
year = string.match (date, '^十一月 (%d+)$')
if year ~= nil then
return year .. "-11"
end
year = string.match (date, '^十二月 (%d+)$')
if year ~= nil then
return year .. "-12"
end
return date
end
return p