Difference between revisions of "Module:Ns has subpages/doc"

From blackwiki
Jump to navigation Jump to search
blackwiki>Mr. Stradivarius
(create)
 
m (7 revisions imported)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
{{high-risk|965000+}}
 +
{{used in system}}
 +
{{Module rating|protected}}
 
This module finds whether a given [[WP:NS|namespace]] can have subpages.
 
This module finds whether a given [[WP:NS|namespace]] can have subpages.
  
Line 5: Line 8:
 
=== From wikitext ===
 
=== From wikitext ===
  
From wikitext this module must be used via the {{tl|ns has subpages}}. Please see the template page for documentation.
+
From wikitext this module must be used via the {{tl|ns has subpages}} template. Please see the template page for documentation.
  
 
=== From Lua ===
 
=== From Lua ===
  
Usually Lua modules should call <code>mw.site.namespaces[''namespace''].hasSubpages</code> rather than using this module. But if you have a good reason, it can be accessed like this:
+
Usually Lua modules should use <code>mw.site.namespaces[''namespace''].hasSubpages</code> rather than this module. But if you have a good reason, it can be accessed like this:
  
 
Load the module:
 
Load the module:
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
local mNsHasSubpages = require('Module:Ns has subpages')
 
local mNsHasSubpages = require('Module:Ns has subpages')
</source>
+
</syntaxhighlight>
  
 
The subpage information can be found with the ._main function:
 
The subpage information can be found with the ._main function:
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
mNsHasSubpages._main(ns, frame)
 
mNsHasSubpages._main(ns, frame)
</source>
+
</syntaxhighlight>
  
 
* <var>ns</var> is the namespace name, number, or a page name. It defaults to the current namespace.
 
* <var>ns</var> is the namespace name, number, or a page name. It defaults to the current namespace.

Latest revision as of 08:10, 27 September 2020

This module finds whether a given namespace can have subpages.

Usage

From wikitext

From wikitext this module must be used via the {{ns has subpages}} template. Please see the template page for documentation.

From Lua

Usually Lua modules should use mw.site.namespaces[namespace].hasSubpages rather than this module. But if you have a good reason, it can be accessed like this:

Load the module:

local mNsHasSubpages = require('Module:Ns has subpages')

The subpage information can be found with the ._main function:

mNsHasSubpages._main(ns, frame)
  • ns is the namespace name, number, or a page name. It defaults to the current namespace.
  • frame is a frame object with which we can call frame:callParserFunction if necessary. This is optional, and intended for internal use.