Module:FeaturedPages
武外梗百科 爱国好学自强图新的百科全书
更多操作
此模块的文档可以在Module:FeaturedPages/doc创建
local p = {}
function p.render(frame)
local category = frame.args.category or "Featured"
local limit = tonumber(frame.args.count) or 4
local catTitle = mw.title.new("Category:" .. category)
if not catTitle or not catTitle.exists then
return "<p>分类不存在。</p>"
end
local pages = catTitle:getContent() -- 占位,确保对象存在
local members = mw.site.stats.pages -- 触发加载
-- Scribunto 无法直接枚举分类成员
-- 所以:Lua 只能负责“包装”,不负责“查询”
return string.format(
'<div class="featured-list">[[Category:%s|查看推荐条目 →]]</div>',
category
)
end
return p