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

local p = {}

function p.get(frame)
    -- Get the page name from the template parameter
    local pageName = frame.args[1] or frame:getParent().args[1]
    
    if not pageName or pageName == "" then
        return "Error: No page name provided."
    end

    -- Create a title object for the page
    local title = mw.title.new(pageName)
    
    if not title then
        return "Error: Invalid page title."
    end

    -- Fetch the raw unparsed wikitext
    local content = title:getContent()
    
    if not content then
        return "Error: Page does not exist or is empty."
    end

    return content
end

return p