Module:RecursiveSelectiveList

From Ikwipedia
Revision as of 07:06, 22 December 2024 by EnWikiAdmin (talk | contribs)

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:getParent().args
    local pageName = args.pageName or "Main Page" -- Default to "Main Page" if no pageName is provided

    -- Use the MediaWiki API to fetch the content of the page
    local pageContent = mw.title.new(pageName):getContent()

    -- Handle cases where the page might not exist
    if not pageContent then
        return "Error: The page '" .. pageName .. "' does not exist or has no content."
    end

    -- Optionally process the content, here simply returning it
    return pageContent
end

return p