Module:SubpageTable:修订间差异
来自OTTOWiki
更多操作
| 第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