Module:RecursiveSelectiveList: Difference between revisions
EnWikiAdmin (talk | contribs) No edit summary Tag: Reverted |
EnWikiAdmin (talk | contribs) No edit summary Tag: Manual revert |
||
Line 5: | Line 5: | ||
-- Retrieve parameters from the template invocation | -- Retrieve parameters from the template invocation | ||
local args = frame.args | local args = frame.args | ||
local | local pageName = args.pageName | ||
-- Check if ' | -- Check if 'pageName' is provided | ||
if not | if not pageName or pageName == "" then | ||
return "Error: ' | return "Error: 'pageName' parameter is missing or empty." | ||
end | end | ||
-- Fetch | -- Fetch content for the specified page | ||
local | local pageContent = mw.title.new(pageName):getContent() | ||
-- | -- Handle cases where the page doesn't exist or has no content | ||
if not pageContent then | |||
return "Error: The page '" .. pageName .. "' does not exist or has no content." | |||
end | end | ||
return pageContent | |||
return | |||
end | end | ||
return p | return p |
Revision as of 07:21, 22 December 2024
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 pageName = args.pageName
-- Check if 'pageName' is provided
if not pageName or pageName == "" then
return "Error: 'pageName' parameter is missing or empty."
end
-- Fetch content for the specified page
local pageContent = mw.title.new(pageName):getContent()
-- Handle cases where the page doesn't exist or has no content
if not pageContent then
return "Error: The page '" .. pageName .. "' does not exist or has no content."
end
return pageContent
end
return p