打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

Module:SubpageTable:修订间差异

来自OTTOWiki
琪露若
琪露若留言 | 贡献 (debug)
第10行: 第10行:
     local namespace = args.namespace or currentTitle.namespace
     local namespace = args.namespace or currentTitle.namespace
      
      
     -- 使用 DPL 查询子页面
     -- 使用 DPL 查询子页面 - 修复的选择规则
     local dplQuery = {
     local dplQuery = {
         'namespace = ' .. namespace,
         'namespace = ' .. namespace,

2025年10月3日 (五) 01:26的版本

local p = {}

function p.table(frame)
    local currentTitle = mw.title.getCurrentTitle()
    local args = frame.args
    
    -- 参数处理
    local limit = args.limit or '50'
    local class = args.class or 'wikitable sortable'
    local namespace = args.namespace or currentTitle.namespace
    
    -- 使用 DPL 查询子页面 - 修复的选择规则
    local dplQuery = {
        'namespace = ' .. namespace,
        'titlematch = ' .. currentTitle.prefixedText .. '/%',
        'mode = userformat',
        'listseparators = {| class="' .. class .. '"\n! 页面名称\n! 最后修改\n! 大小\n|-,\n| [[%PAGE%]]\n| %DATE%\n| %SIZE% 字节,\n|-,\n|}',
        'ordermethod = title',
        'order = ascending',
        'count = ' .. limit,
        'suppresserrors = true'
    }
    
    -- 构建 DPL 标签
    local dplTag = '<dpl>\n' .. table.concat(dplQuery, '\n|') .. '\n</dpl>'
    
    -- 执行 DPL
    return frame:preprocess(dplTag)
end

return p