Module:Class mask
Appearance
![]() | This Lua module is used on approximately 327,000 pages, or roughly 1% of all pages. 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. Consider discussing changes on the talk page before implementing them. |
![]() | This module depends on the following other modules: |
This module implements {{class mask}}. See the template page for documentation.
Quality function
This "quality" function implements the logic needed for Wikipedia:Village pump (proposals)/Archive 198#Project-independent quality assessments.
The module takes a project-defined class |class=
and a banner-defined class (tested via |article_class=
) and normalises the output. The result is prefixed by a letter as follows:
- H: the project class is not defined, or it is defined and equals the article class. In this case WPBannerMeta will hide the display of the quality assessment (categorisation will still happen as usual).
- X: the project class and article class differ, so the tracking category Category:Articles with conflicting quality ratings will be populated.
- Y: the project class is defined and the article class is undefined or invalid. The quality assessment is displayed as usual in the project banner.
This function is tested at Module talk:Class mask/testcases2.
-- This module implements [[Template:Class mask]].
local p = {}
local function getGrade(args, title)
return nil
end
local function getDocWarning(title)
if title.namespace == 10 and title.subpageText == 'class' then
return mw.getCurrentFrame():expandTemplate{
title = 'Class mask/doc warning'
}
end
end
function p._main(args, title)
title = title or mw.title.getCurrentTitle()
local docWarning = getDocWarning(title) or ''
local grade = getGrade(args, title) or ''
return docWarning .. grade
end
function p.main(frame)
return p._main(frame:getParent().args)
end
return p