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

Module:SubpageTable

来自OTTOWiki
琪露若留言 | 贡献2025年10月3日 (五) 01:20的版本 (debug)
local p = {}

function p.table(frame)
    local currentTitle = mw.title.getCurrentTitle()
    local args = frame.args
    
    -- 构建表格
    local tableHtml = '{| class="wikitable sortable"\n! 页面名称\n! 最后修改\n! 大小\n'
    
    for page in mw.site.allPages({
        prefix = currentTitle.prefixedText .. '/',
        limit = 100
    }) do
        local pageTitle = mw.title.new(page)
        if pageTitle then
            tableHtml = tableHtml .. '|-\n'
            tableHtml = tableHtml .. '| [[' .. pageTitle.prefixedText .. ']]\n'
            tableHtml = tableHtml .. '| ' .. (pageTitle.getCurrentRevision and pageTitle:getCurrentRevision().timestamp or '未知') .. '\n'
            tableHtml = tableHtml .. '| ' .. pageTitle.length .. ' 字节\n'
        end
    end
    
    return tableHtml .. '|}'
end

return p