PhantomCaleb (talk | contribs) (# bugfix) |
PhantomCaleb (talk | contribs) No edit summary |
||
(11 intermediate revisions by the same user not shown) | |||
Line 17: | Line 17: | ||
}) |
}) |
||
return #queryResults > 0 and (not noRedirect or queryResults[1]._isRedirect == "0") |
return #queryResults > 0 and (not noRedirect or queryResults[1]._isRedirect == "0") |
||
+ | end |
||
+ | |||
+ | function p.fullUrl(page, queryParams) |
||
+ | local baseUrl = mw.site.server .. mw.site.scriptPath .. "/" |
||
+ | local pageUrl = baseUrl .. mw.uri.encode(page, "WIKI") |
||
+ | if queryParams then |
||
+ | local encodedParams = {} |
||
+ | for k, v in pairs(queryParams) do |
||
+ | local param = k .. "=" .. mw.uri.encode(tostring(v), "QUERY") |
||
+ | table.insert(encodedParams, param) |
||
+ | end |
||
+ | local queryStr = "?" .. table.concat(encodedParams, "&") |
||
+ | pageUrl = pageUrl .. queryStr |
||
+ | end |
||
+ | return pageUrl |
||
end |
end |
||
Line 25: | Line 40: | ||
if k == "format" or type(v) == "table" and v.value == "format" then |
if k == "format" or type(v) == "table" and v.value == "format" then |
||
mw.addWarning("<code>format</code> argument cannot be used here. Format the resulting Lua table instead.") |
mw.addWarning("<code>format</code> argument cannot be used here. Format the resulting Lua table instead.") |
||
− | elseif type( |
+ | elseif type(k) == "number" then |
dplArgs = dplArgs .. h.appendArg(v.param, v.value) |
dplArgs = dplArgs .. h.appendArg(v.param, v.value) |
||
+ | elseif type(v) == "table" then |
||
+ | for _, andedValue in ipairs(v) do |
||
+ | dplArgs = dplArgs .. h.appendArg(k, andedValue) |
||
+ | end |
||
else |
else |
||
dplArgs = dplArgs .. h.appendArg(k, v) |
dplArgs = dplArgs .. h.appendArg(k, v) |
||
Line 79: | Line 98: | ||
end |
end |
||
− | p.Schemas |
+ | function p.Schemas() |
− | + | return { |
|
− | + | exists = { |
|
− | + | fullPageName = { |
|
− | + | type = "string", |
|
+ | required = true, |
||
− | desc = "Full page name with namespace prefix.", |
||
+ | desc = "Full page name with namespace prefix.", |
||
− | }, |
||
+ | }, |
||
− | noRedirect = { |
||
− | + | noRedirect = { |
|
+ | type = "boolean", |
||
− | desc = "If true, redirects are not considered." |
||
+ | desc = "If true, redirects are not considered." |
||
− | }, |
||
− | }, |
||
− | inCategory = { |
||
− | category = { |
||
− | type = "string", |
||
− | required = true, |
||
− | desc = "Category name with or without namespace prefix.", |
||
− | }, |
||
− | fullPageName = { |
||
− | type = "string", |
||
− | required = true, |
||
− | desc = "Full page name with namespace prefix." |
||
− | }, |
||
− | }, |
||
− | inNamespace = { |
||
− | namespaces = { |
||
− | desc = "A namespace or array of namespaces.", |
||
− | required = true, |
||
− | oneOf = { |
||
− | { type = "string" }, |
||
− | { type = "array", items = { type = "string" } } |
||
}, |
}, |
||
}, |
}, |
||
− | + | fullUrl = { |
|
− | + | fullPageName = { |
|
+ | type = "string", |
||
− | desc = "Full pagename. Defaults to the name of the current page." |
||
+ | required = true, |
||
− | } |
||
+ | desc = "Full page name with namespace prefix.", |
||
− | }, |
||
− | stripNamespace = { |
||
− | page = { |
||
− | required = true, |
||
− | type = "string", |
||
− | desc = "Pagename to strip namespace prefix from.", |
||
− | }, |
||
− | namespace = { |
||
− | type = "string", |
||
− | desc = "Namespace to strip. If nil, any namespace will be stripped." |
||
− | }, |
||
− | }, |
||
− | } |
||
− | |||
− | p.Documentation = { |
||
− | exists = { |
||
− | desc = 'Check whether a page exists. Unlike {{Scribunto Manual|lib=mw.title}}, this function does not register a link in [[Special:WantedPages]]. It also does not count as an "expensive parser function."', |
||
− | params = {"fullPageName", "noRedirect"}, |
||
− | returns = "Boolean indicating whether the page exists.", |
||
− | cases = { |
||
− | { |
||
− | args = {"OoT"}, |
||
− | expect = true, |
||
}, |
}, |
||
− | { |
+ | queryParams = { |
− | + | type = "map", |
|
− | + | keys = { type = "string" }, |
|
+ | values = { |
||
+ | oneOf = { |
||
+ | { type = "string" }, |
||
+ | { type = "number" }, |
||
+ | }, |
||
+ | }, |
||
+ | desc = "{{Wp|Query string|Query parameters}}.", |
||
}, |
}, |
||
− | + | }, |
|
+ | inCategory = { |
||
− | desc = "Works for files and file redirects too", |
||
+ | category = { |
||
− | args = {"File:OoT Bomb Bag Model.png"}, |
||
− | + | type = "string", |
|
+ | required = true, |
||
+ | desc = "Category name with or without namespace prefix.", |
||
}, |
}, |
||
− | { |
+ | fullPageName = { |
− | + | type = "string", |
|
− | + | required = true, |
|
+ | desc = "Full page name with namespace prefix." |
||
− | }, |
||
− | { |
||
− | args = {"File:MM Bomb Bag Model.png", true}, |
||
− | expect = false, |
||
− | }, |
||
− | { |
||
− | desc = "Ignores section anchors", |
||
− | args = {"Impa#Biography"}, |
||
− | expect = true, |
||
}, |
}, |
||
}, |
}, |
||
+ | inNamespace = { |
||
− | }, |
||
− | + | namespaces = { |
|
+ | desc = "A namespace or array of namespaces.", |
||
− | desc = "This function is wrapper for the [[gphelp:Extension:DPL3/Manual|DPL]] parser function.", |
||
− | + | required = true, |
|
+ | oneOf = { |
||
− | returns = "Array of results. '''Results are limited to a 500 maximum.'''", |
||
+ | { type = "string" }, |
||
− | cases = { |
||
+ | { type = "array", items = { type = "string" } } |
||
− | { |
||
− | args = { {titlematch = "Link|Zelda", namespace = "Category"} }, |
||
− | expect = {"Category:Link", "Category:Zelda"} |
||
− | }, |
||
− | { |
||
− | desc = "A special array format exists for specifying repeated arguments", |
||
− | args = { |
||
− | { |
||
− | { |
||
− | param = "category", |
||
− | value = "Lynels", |
||
− | }, |
||
− | { |
||
− | param = "notcategory", |
||
− | value = "Enemies in Breath of the Wild", |
||
− | }, |
||
− | { |
||
− | param = "notcategory", |
||
− | value = "Enemies in A Link Between Worlds", |
||
− | }, |
||
− | } |
||
}, |
}, |
||
− | expect = {"Purple Lynel", "Blue Lynel"}, |
||
}, |
}, |
||
+ | fullPageName = { |
||
+ | type = "string", |
||
+ | desc = "Full pagename. Defaults to the name of the current page." |
||
+ | } |
||
}, |
}, |
||
+ | stripNamespace = { |
||
− | }, |
||
− | + | page = { |
|
+ | required = true, |
||
− | params = {"category", "fullPageName"}, |
||
+ | type = "string", |
||
− | returns = "A boolean indicating whether the given page is a member of the given category.", |
||
+ | desc = "Pagename to strip namespace prefix from.", |
||
− | cases = { |
||
− | { |
||
− | desc = "Works with or without the namespace prefix.", |
||
− | args = {"Characters in Breath of the Wild", "Link"}, |
||
− | expect = true, |
||
}, |
}, |
||
− | { |
+ | namespace = { |
− | + | type = "string", |
|
+ | desc = "Namespace to strip. If nil, any namespace will be stripped." |
||
− | expect = true, |
||
}, |
}, |
||
− | + | }, |
|
+ | } |
||
− | args = {"Items", "Link"}, |
||
+ | end |
||
− | expect = false, |
||
+ | |||
+ | function p.Documentation() |
||
+ | return { |
||
+ | exists = { |
||
+ | desc = 'Check whether a page exists. Unlike {{Scribunto Manual|lib=mw.title}}, this function does not register a link in [[Special:WantedPages]]. It also does not count as an "expensive parser function."', |
||
+ | params = {"fullPageName", "noRedirect"}, |
||
+ | returns = "Boolean indicating whether the page exists.", |
||
+ | cases = { |
||
+ | { |
||
+ | args = {"OoT"}, |
||
+ | expect = true, |
||
+ | }, |
||
+ | { |
||
+ | args = {"OoT", true}, |
||
+ | expect = false, |
||
+ | }, |
||
+ | { |
||
+ | desc = "Works for files and file redirects too", |
||
+ | args = {"File:OoT Bomb Bag Model.png"}, |
||
+ | expect = true, |
||
+ | }, |
||
+ | { |
||
+ | args = {"File:MM Bomb Bag Model.png"}, |
||
+ | expect = true, |
||
+ | }, |
||
+ | { |
||
+ | args = {"File:MM Bomb Bag Model.png", true}, |
||
+ | expect = false, |
||
+ | }, |
||
+ | { |
||
+ | desc = "Ignores section anchors", |
||
+ | args = {"Impa#Biography"}, |
||
+ | expect = true, |
||
+ | }, |
||
}, |
}, |
||
− | + | }, |
|
+ | fullUrl = { |
||
− | args = {"Fakecategory", "Link"}, |
||
+ | desc = "A performant alternative to {{Scribunto Manual|lib=mw.uri.fullUrl}}. Unlike <code>mw.uri.fullUrl</code>, it cannot translate interwiki links. To format the link as an internal link, see [[Module:UtilsMarkup#link]].", |
||
− | expect = false, |
||
+ | params = {"fullPageName", "queryParams"}, |
||
− | }, |
||
+ | returns = "The url for the specified wiki page.", |
||
− | { |
||
+ | cases = { |
||
− | desc = "For pages not in the main namespace, the namespace prefix is required.", |
||
+ | { |
||
− | args = {"Characters by Game", "Characters in Breath of the Wild"}, |
||
− | + | args = {"Mipha's Grace"}, |
|
+ | expect = "https://zelda.fandom.com/Mipha%27s_Grace", |
||
− | }, |
||
− | + | }, |
|
+ | { |
||
− | args = {"Characters by Game", "Category:Characters in Breath of the Wild"}, |
||
+ | args = {"Special:Upload", { wpDestFile = "TWWHD Great Fairy Figurine Model.png" } }, |
||
− | expect = true, |
||
+ | expect = "https://zelda.fandom.com/Special:Upload?wpDestFile=TWWHD+Great+Fairy+Figurine+Model.png" |
||
+ | }, |
||
+ | { |
||
+ | args = {"New Page", { |
||
+ | action = "edit", |
||
+ | redlink = 1, |
||
+ | }}, |
||
+ | expect = "https://zelda.fandom.com/New_Page?action=edit&redlink=1", |
||
+ | }, |
||
}, |
}, |
||
}, |
}, |
||
+ | dpl = { |
||
− | }, |
||
+ | desc = "This function is wrapper for the [[gphelp:Extension:DPL3/Manual|DPL]] parser function.", |
||
− | inNamespace = { |
||
− | params = {" |
+ | params = {"args"}, |
+ | returns = "Array of results. '''Results are limited to a 500 maximum.'''", |
||
− | returns = "<code>true</code> if and only if <code>fullPageName</code> (or the current page) has a namespace prefix that is one of <code>namespaces</code>, regardless of whether the page actually exists.", |
||
− | cases = { |
+ | cases = { |
− | { |
+ | { |
+ | args = { {titlematch = "Link|Zelda", namespace = "Category"} }, |
||
− | desc = "Main namespace is the empty string.", |
||
− | + | expect = {"Category:Link", "Category:Zelda"} |
|
− | + | }, |
|
+ | { |
||
+ | desc = "A special array format exists for specifying repeated arguments", |
||
+ | args = { |
||
+ | { |
||
+ | { |
||
+ | param = "category", |
||
+ | value = "Lynels", |
||
+ | }, |
||
+ | { |
||
+ | param = "notcategory", |
||
+ | value = "Enemies in Breath of the Wild", |
||
+ | }, |
||
+ | { |
||
+ | param = "notcategory", |
||
+ | value = "Enemies in A Link Between Worlds", |
||
+ | }, |
||
+ | { |
||
+ | param = "notcategory", |
||
+ | value = "Enemies in Hyrule Warriors: Age of Calamity", |
||
+ | } |
||
+ | } |
||
+ | }, |
||
+ | expect = {"Purple Lynel", "Blue Lynel"}, |
||
+ | }, |
||
+ | { |
||
+ | desc = "Shorthand for repeating an argument", |
||
+ | args = { |
||
+ | { |
||
+ | category = "Lynels", |
||
+ | notcategory = {"Enemies in Breath of the Wild", "Enemies in A Link Between Worlds", "Enemies in Hyrule Warriors: Age of Calamity"} |
||
+ | } |
||
+ | }, |
||
+ | expect = {"Purple Lynel", "Blue Lynel"}, |
||
+ | } |
||
}, |
}, |
||
− | + | }, |
|
+ | inCategory = { |
||
− | args = {"Category", "Link"}, |
||
+ | params = {"category", "fullPageName"}, |
||
− | expect = false, |
||
+ | returns = "A boolean indicating whether the given page is a member of the given category.", |
||
− | }, |
||
− | { |
+ | cases = { |
+ | { |
||
− | args = {"Category", "Category:Link"}, |
||
+ | desc = "Works with or without the namespace prefix.", |
||
− | expect = true, |
||
+ | args = {"Characters in Breath of the Wild", "Link"}, |
||
− | }, |
||
+ | expect = true, |
||
− | { |
||
+ | }, |
||
− | desc = "Can evaluate to true even when page does not exist.", |
||
+ | { |
||
− | args = {"Category", "Category:Flippityfloppityfloo"}, |
||
+ | args = {"Category:Characters", "Link"}, |
||
− | expect = true, |
||
− | + | expect = true, |
|
− | + | }, |
|
+ | { |
||
− | desc = "Current page", |
||
− | args = {" |
+ | args = {"Items", "Link"}, |
− | expect = |
+ | expect = false, |
− | }, |
+ | }, |
− | { |
+ | { |
− | + | args = {"Fakecategory", "Link"}, |
|
+ | expect = false, |
||
− | args = {{"User", "MediaWiki"}, "Princess Zelda"}, |
||
− | + | }, |
|
− | + | { |
|
+ | desc = "For pages not in the main namespace, the namespace prefix is required.", |
||
− | { |
||
− | args = |
+ | args = {"Characters by Game", "Characters in Breath of the Wild"}, |
− | expect = |
+ | expect = false, |
+ | }, |
||
+ | { |
||
+ | args = {"Characters by Game", "Category:Characters in Breath of the Wild"}, |
||
+ | expect = true, |
||
+ | }, |
||
}, |
}, |
||
}, |
}, |
||
+ | inNamespace = { |
||
− | }, |
||
+ | params = {"namespaces", "fullPageName"}, |
||
− | stripNamespace = { |
||
+ | returns = "<code>true</code> if and only if <code>fullPageName</code> (or the current page) has a namespace prefix that is one of <code>namespaces</code>, regardless of whether the page actually exists.", |
||
− | params = {"page", "namespace"}, |
||
+ | cases = { |
||
− | returns = "<code>page</code> with namespace prefix stripped off.", |
||
− | + | { |
|
+ | desc = "Main namespace is the empty string.", |
||
− | outputOnly = true, |
||
+ | args = {"", "Link"}, |
||
− | { |
||
+ | expect = true, |
||
− | args = {"Category:Items in Breath of the Wild", "Category"}, |
||
+ | }, |
||
− | expect = "Items in Breath of the Wild", |
||
− | + | { |
|
+ | args = {"Category", "Link"}, |
||
− | { |
||
+ | expect = false, |
||
− | args = {"Items in Breath of the Wild", "Category"}, |
||
+ | }, |
||
− | expect = "Items in Breath of the Wild", |
||
+ | { |
||
+ | args = {"Category", "Category:Link"}, |
||
+ | expect = true, |
||
+ | }, |
||
+ | { |
||
+ | desc = "Can evaluate to true even when page does not exist.", |
||
+ | args = {"Category", "Category:Flippityfloppityfloo"}, |
||
+ | expect = true, |
||
+ | }, |
||
+ | { |
||
+ | desc = "Current page", |
||
+ | args = {"Module"}, |
||
+ | expect = true, |
||
+ | }, |
||
+ | { |
||
+ | desc = "Multiple namespaces", |
||
+ | args = {{"User", "MediaWiki"}, "Princess Zelda"}, |
||
+ | expect = false, |
||
+ | }, |
||
+ | { |
||
+ | args = {{"User", "MediaWiki"}, "User:Abdullah"}, |
||
+ | expect = true, |
||
+ | }, |
||
}, |
}, |
||
− | + | }, |
|
+ | stripNamespace = { |
||
− | args = {"Category:Items in Breath of the Wild", "File"}, |
||
+ | params = {"page", "namespace"}, |
||
− | expect = "Category:Items in Breath of the Wild", |
||
+ | returns = "<code>page</code> with namespace prefix stripped off.", |
||
− | }, |
||
− | { |
+ | cases = { |
+ | outputOnly = true, |
||
− | args = {"File:TWWHD Tingle Model.png", "File"}, |
||
+ | { |
||
− | expect = "TWWHD Tingle Model.png", |
||
+ | args = {"Category:Items in Breath of the Wild", "Category"}, |
||
− | }, |
||
+ | expect = "Items in Breath of the Wild", |
||
− | { |
||
+ | }, |
||
− | args = {"File:TWWHD Tingle Model.png"}, |
||
+ | { |
||
− | expect = "TWWHD Tingle Model.png", |
||
+ | args = {"Items in Breath of the Wild", "Category"}, |
||
− | }, |
||
+ | expect = "Items in Breath of the Wild", |
||
− | { |
||
+ | }, |
||
− | args = {":Category:Items in Breath of the Wild"}, |
||
+ | { |
||
− | expect = "Items in Breath of the Wild", |
||
+ | args = {"Category:Items in Breath of the Wild", "File"}, |
||
+ | expect = "Category:Items in Breath of the Wild", |
||
+ | }, |
||
+ | { |
||
+ | args = {"File:TWWHD Tingle Model.png", "File"}, |
||
+ | expect = "TWWHD Tingle Model.png", |
||
+ | }, |
||
+ | { |
||
+ | args = {"File:TWWHD Tingle Model.png"}, |
||
+ | expect = "TWWHD Tingle Model.png", |
||
+ | }, |
||
+ | { |
||
+ | args = {":Category:Items in Breath of the Wild"}, |
||
+ | expect = "Items in Breath of the Wild", |
||
+ | } |
||
} |
} |
||
} |
} |
||
} |
} |
||
+ | end |
||
− | } |
||
return p |
return p |
Latest revision as of 05:32, 17 October 2022
exists
exists(fullPageName, [noRedirect])
Check whether a page exists. Unlike mw.title
, this function does not register a link in Special:WantedPages. It also does not count as an "expensive parser function."
Parameters
fullPageName
- Full page name with namespace prefix.
[noRedirect]
- If true, redirects are not considered.
Returns
- Boolean indicating whether the page exists.
Examples
# | Input | Output | Result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | exists("OoT")
| true
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 | exists("OoT", true)
| false
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Works for files and file redirects too | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3 | exists("File:OoT Bomb Bag Model.png")
| true
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4 | exists("File:MM Bomb Bag Model.png")
| true
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5 | exists("File:MM Bomb Bag Model.png", true)
| false
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Ignores section anchors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
6 | exists("Impa#Biography")
| true
|
fullUrl
fullUrl(fullPageName, [queryParams])
A performant alternative to mw.uri.fullUrl
. Unlike mw.uri.fullUrl
, it cannot translate interwiki links. To format the link as an internal link, see Module:UtilsMarkup#link.
Parameters
fullPageName
- Full page name with namespace prefix.
Returns
- The url for the specified wiki page.
Examples
# | Input | Output | Result | Status |
---|---|---|---|---|
7 | fullUrl("Mipha's Grace")
| "https://zelda.fandom.com/Mipha%27s_Grace" | https://zelda.fandom.com/Mipha%27s_Grace | |
8 | fullUrl(
"Special:Upload",
{
wpDestFile = "TWWHD Great Fairy Figurine Model.png",
}
)
| "https://zelda.fandom.com/Special:Upload?wpDestFile=TWWHD+Great+Fairy+Figurine+Model.png" | https://zelda.fandom.com/Special:Upload?wpDestFile=TWWHD+Great+Fairy+Figurine+Model.png | |
9 | fullUrl(
"New Page",
{
action = "edit",
redlink = 1,
}
)
| "https://zelda.fandom.com/New_Page?action=edit&redlink=1" | https://zelda.fandom.com/New_Page?action=edit&redlink=1 |
dpl
dpl(args)
This function is wrapper for the DPL parser function.
Returns
- Array of results. Results are limited to a 500 maximum.
Examples
# | Input | Output | Result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10 | dpl({
namespace = "Category",
titlematch = "Link|Zelda",
})
| {"Category:Link", "Category:Zelda"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A special array format exists for specifying repeated arguments | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
11 | dpl({
{
value = "Lynels",
param = "category",
},
{
value = "Enemies in Breath of the Wild",
param = "notcategory",
},
{
value = "Enemies in A Link Between Worlds",
param = "notcategory",
},
{
value = "Enemies in Hyrule Warriors: Age of Calamity",
param = "notcategory",
},
})
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Shorthand for repeating an argument | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
12 | dpl({
category = "Lynels",
notcategory = {
"Enemies in Breath of the Wild",
"Enemies in A Link Between Worlds",
"Enemies in Hyrule Warriors: Age of Calamity",
},
})
|
|
inCategory
inCategory(category, fullPageName)
Parameters
category
- Category name with or without namespace prefix.
fullPageName
- Full page name with namespace prefix.
Returns
- A boolean indicating whether the given page is a member of the given category.
Examples
# | Input | Output | Result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Works with or without the namespace prefix. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
13 | inCategory("Characters in Breath of the Wild", "Link")
| true
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
14 | inCategory("Category:Characters", "Link")
| true
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
15 | inCategory("Items", "Link")
| false
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
16 | inCategory("Fakecategory", "Link")
| false
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
For pages not in the main namespace, the namespace prefix is required. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
17 | inCategory(
"Characters by Game",
"Characters in Breath of the Wild"
)
| false
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
18 | inCategory(
"Characters by Game",
"Category:Characters in Breath of the Wild"
)
| true
|
inNamespace
inNamespace(namespaces, [fullPageName])
Parameters
namespaces
- A namespace or array of namespaces.
[fullPageName]
- Full pagename. Defaults to the name of the current page.
Returns
true
if and only iffullPageName
(or the current page) has a namespace prefix that is one ofnamespaces
, regardless of whether the page actually exists.
Examples
# | Input | Output | Result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Main namespace is the empty string. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
19 | inNamespace("", "Link")
| true
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
20 | inNamespace("Category", "Link")
| false
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
21 | inNamespace("Category", "Category:Link")
| true
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Can evaluate to true even when page does not exist. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
22 | inNamespace("Category", "Category:Flippityfloppityfloo")
| true
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Current page | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
23 | inNamespace("Module")
| true
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Multiple namespaces | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
24 | inNamespace({"User", "MediaWiki"}, "Princess Zelda")
| false
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
25 | inNamespace({"User", "MediaWiki"}, "User:Abdullah")
| true
|
stripNamespace
stripNamespace(page, [namespace])
Parameters
page
- Pagename to strip namespace prefix from.
[namespace]
- Namespace to strip. If nil, any namespace will be stripped.
Returns
page
with namespace prefix stripped off.
Examples
# | Input | Output | Status |
---|---|---|---|
26 | stripNamespace("Category:Items in Breath of the Wild", "Category")
| "Items in Breath of the Wild" | |
27 | stripNamespace("Items in Breath of the Wild", "Category")
| "Items in Breath of the Wild" | |
28 | stripNamespace("Category:Items in Breath of the Wild", "File")
| "Category:Items in Breath of the Wild" | |
29 | stripNamespace("File:TWWHD Tingle Model.png", "File")
| "TWWHD Tingle Model.png" | |
30 | stripNamespace("File:TWWHD Tingle Model.png")
| "TWWHD Tingle Model.png" | |
31 | stripNamespace(":Category:Items in Breath of the Wild")
| "Items in Breath of the Wild" |
local p = {}
local h = {}
local utilsCargo = require("Module:UtilsCargo")
local utilsString = require("Module:UtilsString")
local utilsTable = require("Module:UtilsTable")
function p.exists(fullPageName, noRedirect)
local anchorStart = string.find(fullPageName, "#")
if anchorStart then
fullPageName = string.sub(fullPageName, 1, anchorStart - 1)
end
local queryResults = utilsCargo.query("_pageData", "_pageName, _isRedirect", {
where = utilsCargo.allOf({
_pageName = fullPageName
})
})
return #queryResults > 0 and (not noRedirect or queryResults[1]._isRedirect == "0")
end
function p.fullUrl(page, queryParams)
local baseUrl = mw.site.server .. mw.site.scriptPath .. "/"
local pageUrl = baseUrl .. mw.uri.encode(page, "WIKI")
if queryParams then
local encodedParams = {}
for k, v in pairs(queryParams) do
local param = k .. "=" .. mw.uri.encode(tostring(v), "QUERY")
table.insert(encodedParams, param)
end
local queryStr = "?" .. table.concat(encodedParams, "&")
pageUrl = pageUrl .. queryStr
end
return pageUrl
end
local SEPARATOR = "#"
function p.dpl(args)
local dplArgs = ""
for k, v in pairs(args) do
if k == "format" or type(v) == "table" and v.value == "format" then
mw.addWarning("<code>format</code> argument cannot be used here. Format the resulting Lua table instead.")
elseif type(k) == "number" then
dplArgs = dplArgs .. h.appendArg(v.param, v.value)
elseif type(v) == "table" then
for _, andedValue in ipairs(v) do
dplArgs = dplArgs .. h.appendArg(k, andedValue)
end
else
dplArgs = dplArgs .. h.appendArg(k, v)
end
end
dplArgs = dplArgs .. h.appendArg("format", SEPARATOR..",,%PAGE%" .. SEPARATOR .. ",")
local result = mw.getCurrentFrame():preprocess("{{#dpl:" .. dplArgs .. "}}")
if not utilsString.endsWith(result, SEPARATOR) then
return {}
end
result = string.gsub(result, SEPARATOR .. ":", SEPARATOR) -- strip : prefix from Category results
result = utilsString.trim(result, SEPARATOR)
result = utilsString.split(result, SEPARATOR)
return result
end
function h.appendArg(param, value)
value = tostring(value)
value = string.gsub(value, "\|", "{{!}}")
if param and value then
return "|" .. param .. "=" .. value .. "\n"
else
return ""
end
end
function p.inCategory(category, fullPageName)
if (not category) or (not fullPageName) then
return false
end
local title = mw.title.new(fullPageName)
local dplResult = p.dpl({
category= p.stripNamespace(category),
namespace= title.nsText,
title= title.text,
})
return #dplResult ~= 0
end
function p.inNamespace(namespaces, fullPageName)
if type(namespaces) == "string" then
namespaces = {namespaces}
end
local title = fullPageName and mw.title.new(fullPageName) or mw.title.getCurrentTitle()
return utilsTable.includes(namespaces, title.nsText)
end
function p.stripNamespace(page, namespace)
if not namespace then
namespace = "[^:]*"
end
return string.gsub(page, ":?".. namespace..":", "")
end
function p.Schemas()
return {
exists = {
fullPageName = {
type = "string",
required = true,
desc = "Full page name with namespace prefix.",
},
noRedirect = {
type = "boolean",
desc = "If true, redirects are not considered."
},
},
fullUrl = {
fullPageName = {
type = "string",
required = true,
desc = "Full page name with namespace prefix.",
},
queryParams = {
type = "map",
keys = { type = "string" },
values = {
oneOf = {
{ type = "string" },
{ type = "number" },
},
},
desc = "{{Wp|Query string|Query parameters}}.",
},
},
inCategory = {
category = {
type = "string",
required = true,
desc = "Category name with or without namespace prefix.",
},
fullPageName = {
type = "string",
required = true,
desc = "Full page name with namespace prefix."
},
},
inNamespace = {
namespaces = {
desc = "A namespace or array of namespaces.",
required = true,
oneOf = {
{ type = "string" },
{ type = "array", items = { type = "string" } }
},
},
fullPageName = {
type = "string",
desc = "Full pagename. Defaults to the name of the current page."
}
},
stripNamespace = {
page = {
required = true,
type = "string",
desc = "Pagename to strip namespace prefix from.",
},
namespace = {
type = "string",
desc = "Namespace to strip. If nil, any namespace will be stripped."
},
},
}
end
function p.Documentation()
return {
exists = {
desc = 'Check whether a page exists. Unlike {{Scribunto Manual|lib=mw.title}}, this function does not register a link in [[Special:WantedPages]]. It also does not count as an "expensive parser function."',
params = {"fullPageName", "noRedirect"},
returns = "Boolean indicating whether the page exists.",
cases = {
{
args = {"OoT"},
expect = true,
},
{
args = {"OoT", true},
expect = false,
},
{
desc = "Works for files and file redirects too",
args = {"File:OoT Bomb Bag Model.png"},
expect = true,
},
{
args = {"File:MM Bomb Bag Model.png"},
expect = true,
},
{
args = {"File:MM Bomb Bag Model.png", true},
expect = false,
},
{
desc = "Ignores section anchors",
args = {"Impa#Biography"},
expect = true,
},
},
},
fullUrl = {
desc = "A performant alternative to {{Scribunto Manual|lib=mw.uri.fullUrl}}. Unlike <code>mw.uri.fullUrl</code>, it cannot translate interwiki links. To format the link as an internal link, see [[Module:UtilsMarkup#link]].",
params = {"fullPageName", "queryParams"},
returns = "The url for the specified wiki page.",
cases = {
{
args = {"Mipha's Grace"},
expect = "https://zelda.fandom.com/Mipha%27s_Grace",
},
{
args = {"Special:Upload", { wpDestFile = "TWWHD Great Fairy Figurine Model.png" } },
expect = "https://zelda.fandom.com/Special:Upload?wpDestFile=TWWHD+Great+Fairy+Figurine+Model.png"
},
{
args = {"New Page", {
action = "edit",
redlink = 1,
}},
expect = "https://zelda.fandom.com/New_Page?action=edit&redlink=1",
},
},
},
dpl = {
desc = "This function is wrapper for the [[gphelp:Extension:DPL3/Manual|DPL]] parser function.",
params = {"args"},
returns = "Array of results. '''Results are limited to a 500 maximum.'''",
cases = {
{
args = { {titlematch = "Link|Zelda", namespace = "Category"} },
expect = {"Category:Link", "Category:Zelda"}
},
{
desc = "A special array format exists for specifying repeated arguments",
args = {
{
{
param = "category",
value = "Lynels",
},
{
param = "notcategory",
value = "Enemies in Breath of the Wild",
},
{
param = "notcategory",
value = "Enemies in A Link Between Worlds",
},
{
param = "notcategory",
value = "Enemies in Hyrule Warriors: Age of Calamity",
}
}
},
expect = {"Purple Lynel", "Blue Lynel"},
},
{
desc = "Shorthand for repeating an argument",
args = {
{
category = "Lynels",
notcategory = {"Enemies in Breath of the Wild", "Enemies in A Link Between Worlds", "Enemies in Hyrule Warriors: Age of Calamity"}
}
},
expect = {"Purple Lynel", "Blue Lynel"},
}
},
},
inCategory = {
params = {"category", "fullPageName"},
returns = "A boolean indicating whether the given page is a member of the given category.",
cases = {
{
desc = "Works with or without the namespace prefix.",
args = {"Characters in Breath of the Wild", "Link"},
expect = true,
},
{
args = {"Category:Characters", "Link"},
expect = true,
},
{
args = {"Items", "Link"},
expect = false,
},
{
args = {"Fakecategory", "Link"},
expect = false,
},
{
desc = "For pages not in the main namespace, the namespace prefix is required.",
args = {"Characters by Game", "Characters in Breath of the Wild"},
expect = false,
},
{
args = {"Characters by Game", "Category:Characters in Breath of the Wild"},
expect = true,
},
},
},
inNamespace = {
params = {"namespaces", "fullPageName"},
returns = "<code>true</code> if and only if <code>fullPageName</code> (or the current page) has a namespace prefix that is one of <code>namespaces</code>, regardless of whether the page actually exists.",
cases = {
{
desc = "Main namespace is the empty string.",
args = {"", "Link"},
expect = true,
},
{
args = {"Category", "Link"},
expect = false,
},
{
args = {"Category", "Category:Link"},
expect = true,
},
{
desc = "Can evaluate to true even when page does not exist.",
args = {"Category", "Category:Flippityfloppityfloo"},
expect = true,
},
{
desc = "Current page",
args = {"Module"},
expect = true,
},
{
desc = "Multiple namespaces",
args = {{"User", "MediaWiki"}, "Princess Zelda"},
expect = false,
},
{
args = {{"User", "MediaWiki"}, "User:Abdullah"},
expect = true,
},
},
},
stripNamespace = {
params = {"page", "namespace"},
returns = "<code>page</code> with namespace prefix stripped off.",
cases = {
outputOnly = true,
{
args = {"Category:Items in Breath of the Wild", "Category"},
expect = "Items in Breath of the Wild",
},
{
args = {"Items in Breath of the Wild", "Category"},
expect = "Items in Breath of the Wild",
},
{
args = {"Category:Items in Breath of the Wild", "File"},
expect = "Category:Items in Breath of the Wild",
},
{
args = {"File:TWWHD Tingle Model.png", "File"},
expect = "TWWHD Tingle Model.png",
},
{
args = {"File:TWWHD Tingle Model.png"},
expect = "TWWHD Tingle Model.png",
},
{
args = {":Category:Items in Breath of the Wild"},
expect = "Items in Breath of the Wild",
}
}
}
}
end
return p