加帕里图书馆 - 兽娘动物园中文维基
动物朋友 けものフレンズ KemonoFriends百科
查看“︁模块:历史上的今天”︁的源代码
←
模块:历史上的今天
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} -- 加载数据模块 local data = mw.loadData('Module:历史上的今天/数据') function p.show() local output = {} -- 获取当前日期 -- 获取当前的月和日,使用数字格式 local month = tonumber(mw.getContentLanguage():formatDate("n")) local day = tonumber(mw.getContentLanguage():formatDate("j")) local key = month .. "-" .. day -- 例如 "3-16" local today_events = data[key] -- 获取当前年份 local current_year = tonumber(os.date("%Y")) if today_events and #today_events > 0 then -- 循环处理当天的所有事件 for _, item in ipairs(today_events) do local event_year = item.year local years_ago = current_year - event_year local event_desc = item.event -- 使用 Wikitext 格式化输出 local line = string.format( "* '''%d年''' (%d 年前): %s", event_year, years_ago, event_desc ) table.insert(output, line) end else -- 没有事件记录 table.insert(output, "今日暂无历史事件记录") end -- 添加脚注/链接 table.insert(output, "\n<div style=\"text-align: right; margin-top: 5px; font-size: 85%;\">") table.insert(output, "[[年表|查看完整年表]]") table.insert(output, "</div>") return table.concat(output, "\n") end return p
该页面使用的模板:
模块:历史上的今天/doc
(
查看源代码
)
返回
模块:历史上的今天
。
导航菜单
个人工具
创建账号
登录
命名空间
模块
讨论
English
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
工具
链入页面
相关更改
页面信息