Module:DateTitleList:修订间差异

跳转到导航 跳转到搜索
无编辑摘要
无编辑摘要
第3行: 第3行:
local function format_date(date_str, title, year)
local function format_date(date_str, title, year)
     local year_in_date = string.sub(date_str, 1, 4)
     local year_in_date = string.sub(date_str, 1, 4)
     local month_day = os.date("%m月%d日", os.time{year=string.sub(date_str, 1, 4), month=string.sub(date_str, 5, 6), day=string.sub(date_str, 7, 8)})
     local month_day = os.date("%m月%d日", os.time{year=tonumber(year_in_date), month=tonumber(string.sub(date_str, 5, 6)), day=tonumber(string.sub(date_str, 7, 8))})
     local category_link = string.format("[[:Category:%s|%s]]", month_day, month_day)
     local category_link
   
 
     if year_in_date ~= year then
     if year_in_date ~= year then
         category_link = string.format("[[:Category:%s|%s{{ruby|%s|''%s年''}}]]", month_day, month_day, year_in_date)
         category_link = string.format("[[:Category:%s|%s{{ruby|%s|''%s年''}}]]", month_day, month_day, month_day, year_in_date)
    else
        category_link = string.format("[[:Category:%s|%s]]", month_day, month_day)
     end
     end
   
 
     local page_link = string.format("[[直播记录/vedal987频道/%s年%s|%s]]", year_in_date, month_day, title)
     local page_link = string.format("[[直播记录/vedal987频道/%s年%s|%s]]", year_in_date, month_day, title)
     return string.format("* '''%s''' %s", category_link, page_link)
     return string.format("* '''%s''' %s", category_link, page_link)