Jump to content

Module:RawText

From Insurer Brain
Revision as of 22:48, 28 March 2026 by Wikilah admin (talk | contribs) (Created page with "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 conten...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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