Module:Util/pages/listSubpages/Documentation/Spec: Difference between revisions

From Zelda Wiki, the Zelda encyclopedia
Jump to navigation Jump to search
No edit summary
No edit summary
 
(No difference)

Latest revision as of 19:41, 11 May 2024

Documentation for this module may be created at Module:Util/pages/listSubpages/Documentation/Spec/Documentation

local p = {}

function p.Schemas()
	return {
		fullPageName = {
			type = "string",
			desc = "A full page name with namespace prefix. If nil, <code>mw.title.getCurrentTitle()</code> is used.",
		},
		options = {
			type = "record",
			properties = {
				depth = {
					type = "number",
					desc = "If nil or a negative number, the function will return ''all'' subpages, including sub-subpages, sub-sub-subpages, and so on."
						.. " Otherwise, only the subpages at or above <code>depth</code> are returned."
						.. " (Setting this to <code>1</code> will cause only the direct subpages to be returned.)"
				},
				noDocumentation = {
					type = "boolean",
					desc = "If true, any <code>/Documentation</code> pages (or subpages thereof) will not be included in the result."
				},
			}
		},
		
	}
end

function p.Documentation()
	return {
		params = {"fullPageName", "options"},
		returns = "A list of subpages",
		cases = {
			outputOnly = true,
			{
				args = {"Module:Constants", { depth = 2, noDocumentation= true} },
			},
			{
				args = {"Module:Constants", { depth = 1 }},
			},
			{
				args = {"Module:Constants"},
			},
			{
				args = {},
			},
		},
	}
end

return p