Module:Maintenance: Difference between revisions
From Inkipedia, the Splatoon wiki
(Created page with "local p = {} function p.main(frame) -- No args needed return p.getMaintenanceTable() end function p.getMaintenanceTable() -- Create the table element local result = mw.html.create('table') result :addClass('wikitable') :addClass('sitecolor-generic') :addClass('mw-collapsible') :css('text-align', 'center') -- Add header row result:tag('tr') :tag('th') :attr('colspan', '10') :wikitext('M...") |
Yoshifan52 (talk | contribs) m (Protected "Module:Maintenance": Widely transcluded template ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 54: | Line 54: | ||
} | } | ||
for _, countCategory in ipairs(countCategories) do | for _, countCategory in ipairs(countCategories) do | ||
local count = mw.site.stats.pagesInCategory(countCategory, 'all') | |||
countsRow:tag('td'):wikitext(count) | countsRow:tag('td'):wikitext(count) | ||
end | end |
Latest revision as of 07:10, 11 February 2024
Usage
This template is intended for use on Special:RecentChanges and/or the Main Page. The template lists maintenance tasks. Not all maintenance task types are present in the template; see Inkipedia:Maintenance for a complete list of task types.
local p = {} function p.main(frame) -- No args needed return p.getMaintenanceTable() end function p.getMaintenanceTable() -- Create the table element local result = mw.html.create('table') result :addClass('wikitable') :addClass('sitecolor-generic') :addClass('mw-collapsible') :css('text-align', 'center') -- Add header row result:tag('tr') :tag('th') :attr('colspan', '10') :wikitext('Maintenance') -- Add the category names row local categoriesRow = result:tag('tr') local categories = { 'Pending [[:Category:Pages pending move|moves or splits]]', '[[:Category:Articles under construction|Articles under construction]]', '[[:Category:Stubs|Stubs]]', '[[:Category:Pages with translation needed|Pages with translation needed]]', '[[:Category:Files needing reupload|Files needing improvement]]', '[[:Category:Articles needing images|Articles needing images]]', '[[:Category:Policy proposals|Policy proposals]]', '[[:Category:Active demotion requests|Active demotion requests]]', '[[:Category:Active rights requests|Active rights requests]]', 'Pending [[:Category:Pages pending deletion|deletions]]' } for _, category in ipairs(categories) do categoriesRow:tag('th'):wikitext(category) end -- Add the counts row local countsRow = result:tag('tr') local countCategories = { 'Pages pending move', 'Articles under construction', 'Stubs', 'Pages with translation needed', 'Files needing reupload', 'Articles needing images', 'Policy proposals', 'Active demotion requests', 'Active rights requests', 'Pages pending deletion' } for _, countCategory in ipairs(countCategories) do local count = mw.site.stats.pagesInCategory(countCategory, 'all') countsRow:tag('td'):wikitext(count) end return tostring(result) end return p