Module:SubpageTable:修订间差异
来自OTTOWiki
更多操作
| 第1行: | 第1行: | ||
local p = {} | local p = {} | ||
function p. | function p.table(frame) | ||
local currentTitle = mw.title.getCurrentTitle() | |||
local args = frame.args | local args = frame.args | ||
-- | -- 构建表格 | ||
local | local tableHtml = '{| class="wikitable sortable"\n! 页面名称\n! 最后修改\n! 大小\n' | ||
for page in mw.site.allPages({ | |||
prefix = currentTitle.prefixedText .. '/', | prefix = currentTitle.prefixedText .. '/', | ||
limit = 100 | |||
limit = | }) do | ||
}) | |||
local pageTitle = mw.title.new(page) | local pageTitle = mw.title.new(page) | ||
if pageTitle then | 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' | |||
tableHtml = tableHtml .. | |||
end | end | ||
end | end | ||
return tableHtml | return tableHtml .. '|}' | ||
end | end | ||
return p | return p | ||
2025年10月3日 (五) 01:20的版本
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