Jump to content

Module:Data page description

From HopperWiki

Documentation for this module may be created at Module:Data page description/doc

local getArgs = require('Module:Arguments').getArgs -- for processing arguments
local cargo = mw.ext.cargo -- for cargo queries if needed

local p = {}


-- function to pre-process arguments
function p.main(frame)
    local args = getArgs(frame)
    args.parent_title = mw.title.getCurrentTitle().text
    return p._main(args)
end

function p.doc(frame)
    local args = getArgs(frame)
    args.parent_title = mw.title.getCurrentTitle().text
    return p._doc(args)
end


-- main function goes here
function p._main(args)

    if args.Parent_page then
	    local output = "This page contains supplementary data for " ..
	    "[[" .. args.Parent_page .. "]]" .. 
	    " and thus should be called from that page."
	    return(output)
    else
    	return("This page in the data namespace is orphaned and can't find it's forward-facing page")
    end
end

-- function to explain template purpose (this needs to be in a separate function so it can be transcluded distinctly)
function p._doc(args)
    local output = "This template is for streamlining descriptions of how data pages should be used by calling them from their parent (forward facing) pages."
    return output
    
end



return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.