Module:RecursiveSelectiveList: Difference between revisions

From Ikwipedia
No edit summary
No edit summary
Line 3: Line 3:


function p.main(frame)
function p.main(frame)
     -- Retrieve parameters from the template invocation
     -- Debugging: Display the raw input from the template
     local args = frame:getParent().args
     local args = frame:getParent().args
     local pageName = args.pageName or "Main Page" -- Default to "Main Page" if no pageName is provided
     local pageName = args.pageName or "Main Page"
 
      
     -- Use the MediaWiki API to fetch the content of the page
     -- Display what was captured
    local pageContent = mw.title.new(pageName):getContent()
     return "Debug: pageName = " .. pageName
 
     -- 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
end


return p
return p

Revision as of 07:09, 22 December 2024

Documentation for this module may be created at Module:RecursiveSelectiveList/doc

local p = {}
local mw = require('mw')

function p.main(frame)
    -- Debugging: Display the raw input from the template
    local args = frame:getParent().args
    local pageName = args.pageName or "Main Page"
    
    -- Display what was captured
    return "Debug: pageName = " .. pageName
end

return p