缺氧 wiki 编辑团队提示:注册账号并登录后体验更佳,且可通过参数设置定制优化您的浏览体验!

该站点为镜像站点,如果你想帮助这个由玩家志愿编辑的 wiki 站点,请前往原站点参与编辑,
同时欢迎加入编辑讨论群 851803695 与其他编辑者一起参与建设!

全站通知:

模块:Data/RecentEdit

来自缺氧WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

此模块的文档可以在模块:Data/RecentEdit/doc创建

-- Module:Data/Pagetouched
local fstr = mw.ustring.format -- shortcut for formattig a string
local getArgs = require(' Module:Dev/Arguments').getArgs
local sepEntry = "<br>"
local cats = {
    "包含测试版信息的页面", "包含最新信息的页面",
    "未找到过时信息的页面"
}
local nocats = {
    "直接导入的页面", "待翻译页面", "需要完善的页面",
    "有脚本错误的页面", "未实装内容", "已移除内容"
}
local articleCount = 10
function main()
    local dplArgs = {
        category = table.concat(cats, "|"),
        namespace = "",
        order = "descending",
        ordermethod = "lastedit",
        format = "," .. sepEntry .. "%TITLE%,,",
        count = articleCount + 1
    }
    for _, cat in ipairs(nocats) do
        table.insert(dplArgs, 'notcategory = ' .. cat)
    end

    local dplResult = mw.getCurrentFrame():callParserFunction('#dpl:', dplArgs)
    local articles = mw.text.split(dplResult, sepEntry, true)

    local out = {}
    for i = 2, #articles do
        local title = articles[i]
        local content = mw.title.new(title):getContent()
        content = mw.ustring.gsub(content, "<includeonly>.-</%s*includeonly>",
                                  "")
        content = mw.ustring.gsub(content, "</?%s*onlyinclude>", "")
        content = mw.ustring.gsub(content, "</?%s*noinclude>", "")
        table.insert(out, {title, content})
    end
    return out
end

return main()
-- test: = mw.logObject(p)