Jump to content
Wikipedia The Free Encyclopedia

Module:Category handler/shared

From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing.
Page protected This module is currently protected from editing.
See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected.
This module can only be edited by administrators because it is transcluded onto one or more cascade-protected pages.
[画像:Warning] This Lua module is used in system messages, and on approximately 4,890,000 pages, or roughly 8% of all pages.
Changes to it can cause immediate changes to the Wikipedia user interface.
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Please discuss changes on the talk page before implementing them.
This module depends on the following other modules:

Usage

{{#invoke:Category handler|function_name}}

The above documentation is transcluded from Module:Category handler/shared/doc. (edit | history)
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.

 -- This module contains shared functions used by [[Module:Category handler]]
 -- and its submodules.

 localp={}

 functionp.matchesBlacklist(page,blacklist)
 fori,patterninipairs(blacklist)do
 localmatch=mw.ustring.match(page,pattern)
 ifmatchthen
 returntrue
 end
 end
 returnfalse
 end

 functionp.getParamMappings(useLoadData)
 localdataPage='Module:Namespace detect/data'
 ifuseLoadDatathen
 returnmw.loadData(dataPage).mappings
 else
 returnrequire(dataPage).mappings
 end
 end

 functionp.getNamespaceParameters(titleObj,mappings)
 -- We don't use title.nsText for the namespace name because it adds
 -- underscores.
 localmappingsKey
 iftitleObj.isTalkPagethen
 mappingsKey='talk'
 else
 mappingsKey=mw.site.namespaces[titleObj.namespace].name
 end
 mappingsKey=mw.ustring.lower(mappingsKey)
 returnmappings[mappingsKey]or{}
 end

 returnp

AltStyle によって変換されたページ (->オリジナル) /