Module:RecursiveSelectiveList
Documentation for this module may be created at Module:RecursiveSelectiveList/doc
local p = {}
local mw = require('mw')
function p.main(frame)
-- Retrieve parameters from the template invocation
local args = frame.args
local categoryName = args.categoryName
-- Check if 'categoryName' is provided
if not categoryName or categoryName == "" then
return "Error: 'categoryName' parameter is missing or empty."
end
-- Fetch pages in the category
local category = mw.site.getCategory(categoryName)
if not category then
return "Error: Category '" .. categoryName .. "' does not exist."
end
-- Retrieve the list of pages
local pages = {}
for page in category:members() do
table.insert(pages, "* [[" .. page.title .. "]]")
end
-- Return the list as a formatted string
return table.concat(pages, "\n")
end
return p