Module:Util/pages/listSubpages/Documentation/Spec: Difference between revisions
PhantomCaleb (talk | contribs) (Created page with "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.", }, } end function p.Documentation() return { params = {"fullPageName"}, returns = "A list of subpages", cases = { outputOnly = true, { args = {"Module:Constants"}, }, { args = {}, }, }, } end return p") |
PhantomCaleb (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 7: | Line 7: | ||
desc = "A full page name with namespace prefix. If nil, <code>mw.title.getCurrentTitle()</code> is used.", | 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 | end | ||
Line 12: | Line 28: | ||
function p.Documentation() | function p.Documentation() | ||
return { | return { | ||
params = {"fullPageName"}, | params = {"fullPageName", "options"}, | ||
returns = "A list of subpages", | returns = "A list of subpages", | ||
cases = { | cases = { | ||
outputOnly = true, | outputOnly = true, | ||
{ | |||
args = {"Module:Constants", { depth = 2, noDocumentation= true} }, | |||
}, | |||
{ | |||
args = {"Module:Constants", { depth = 1 }}, | |||
}, | |||
{ | { | ||
args = {"Module:Constants"}, | args = {"Module:Constants"}, |
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