缺氧 wiki 编辑团队提示:注册账号并登录后体验更佳,且可通过参数设置定制优化您的浏览体验!
该站点为镜像站点,如果你想帮助这个由玩家志愿编辑的 wiki 站点,请前往原站点参与编辑,
同时欢迎加入编辑讨论群 851803695 与其他编辑者一起参与建设!
全站通知:
模块:Data/PagesVersions
刷
历
编
< 模块:Data
跳到导航
跳到搜索
此模块的文档可以在模块:Data/PagesVersions/doc创建
-- Data/PagesVersions
-- 获取各个页面的版本信息
local utils = require([[Module:Utils]])
local versionModule = require([[Module:游戏版本]])
local vData = mw.loadData([[Module:Data/版本]])
local timeDiff = mw.loadData([[Module:Data/TimeDiff]])
local date = require('Dev:Date')
local fstr = mw.ustring.format -- shortcut for formattig a string
local sepEntry = "<br>"
local sepSec = "@$"
local paramInclude = {}
for _, v in ipairs({"1", "build", "ex"}) do
table.insert(paramInclude, fstr("{游戏版本}:%s", v))
end
paramInclude = table.concat(paramInclude, ",")
-- test by: =p.getPages()
local function getPages(args)
local cats = {}
local catsSet = {}
for _, v in pairs(versionModule.CATEGORY) do
table.insert(cats, v)
catsSet[v] = true
end
local dplResults = {}
for _, cat in ipairs(cats) do
local dplArgs = {
category = cat,
-- notcategory = "直接导入的页面",
include = paramInclude,
format = "," .. sepEntry .. "%TITLE%|%DATE%|%CATNAMES%|",
count = 999999,
addcategories = "true",
addeditdate = "true",
ordermethod = "lastedit",
userdateformat = "YmdHis",
secseparators = sepSec
}
table.insert(dplResults,
mw.getCurrentFrame():callParserFunction('#dpl:', dplArgs))
end
local dplResult = table.concat(dplResults, "")
local lines = mw.text.split(dplResult, sepEntry, true)
local articles = {}
for i = 2, #lines do
local secs = mw.text.split(lines[i], "|", true)
local currTitle = secs[1]
local currEditTime = secs[2]
local currCats = secs[3]
local rawArgs = mw.text.split(secs[4], sepSec, true)
local versionArgs = {}
versionArgs[1] = rawArgs[2] ~= "" and rawArgs[2] or nil
versionArgs.build = rawArgs[3] ~= "" and rawArgs[3] or nil
versionArgs.ex = rawArgs[4] ~= "" and rawArgs[4] or nil
table.insert(articles, {
title = currTitle,
editBefore = (date():addseconds(timeDiff.seconds) - currEditTime):fmt(
"%Y%m%d%H%M%S"),
cats = currCats,
versionArgs = versionArgs
})
end
return articles
end
return getPages()
-- test: mw.logObject(p)