首页
随机
登录
设置
关于NeuroWiki
免责声明
NeuroWiki
搜索
查看“Module:DateTitleList”的源代码
←
Module:DateTitleList
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您必须确认您的电子邮件地址才能编辑页面。请通过
参数设置
设置并确认您的电子邮件地址。
您可以查看和复制此页面的源代码。
local p = {} local function format_date(date_str, title, year) local year_in_date = string.sub(date_str, 1, 4) 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 if year_in_date ~= year then 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 local page_link = string.format("[[直播记录/vedal987频道/%s年%s|%s]]", year_in_date, month_day, title) return string.format("* '''%s''' %s", category_link, page_link) end local function compare_dates(a, b) return a.date < b.date end function p.main(frame) local args = frame:getParent().args local year = args.year or os.date("%Y") local entries = {} for i = 1, 7 do local date = args["date" .. i] local title = args["title" .. i] if date and title then table.insert(entries, {date = date, title = title}) end end table.sort(entries, compare_dates) local result = {} for _, entry in ipairs(entries) do table.insert(result, format_date(entry.date, entry.title, year)) end return table.concat(result, "\n") end return p
该页面使用的模板:
Module:DateTitleList/doc
(
查看源代码
)
返回
Module:DateTitleList
。