Module:CategoryList: Difference between revisions
From Vintage Story Wiki
mNo edit summary |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
function p. | function p.devVersions(f) | ||
local args = require( 'Module:ProcessArgs' ).merge( true ) | local args = require( 'Module:ProcessArgs' ).merge( true ) | ||
local title = mw.title.getCurrentTitle().baseText | local title = mw.title.getCurrentTitle().baseText | ||
local preReleases = mw.site.stats.pagesInCategory(title .. 'pre-releases', 'pages') | local preReleases = mw.site.stats.pagesInCategory(title .. ' pre-releases', 'pages') | ||
local releaseCandidates = mw.site.stats.pagesInCategory(title .. 'release candidates', 'pages') | local releaseCandidates = mw.site.stats.pagesInCategory(title .. ' release candidates', 'pages') | ||
local links = '' | local links = '' | ||
Line 15: | Line 15: | ||
if releaseCandidates > 0 then | if releaseCandidates > 0 then | ||
links = links .. '<li>[[:Category:' .. title .. ' release candidates|\'\'\'Release candidates\'\'\' (' .. releaseCandidates .. ')]]</li>' | links = links .. '<li>[[:Category:' .. title .. ' release candidates|\'\'\'Release candidates\'\'\' (' .. releaseCandidates .. ')]]</li>' | ||
end | end | ||
Latest revision as of 00:03, 28 August 2022
Documentation for this module may be created at Module:CategoryList/doc
local p = {}
function p.devVersions(f)
local args = require( 'Module:ProcessArgs' ).merge( true )
local title = mw.title.getCurrentTitle().baseText
local preReleases = mw.site.stats.pagesInCategory(title .. ' pre-releases', 'pages')
local releaseCandidates = mw.site.stats.pagesInCategory(title .. ' release candidates', 'pages')
local links = ''
if preReleases > 0 then
links = links .. '<li>[[:Category:' .. title .. ' pre-releases|\'\'\'Pre-releases\'\'\' (' .. preReleases .. ')]]</li>'
end
if releaseCandidates > 0 then
links = links .. '<li>[[:Category:' .. title .. ' release candidates|\'\'\'Release candidates\'\'\' (' .. releaseCandidates .. ')]]</li>'
end
local body = '<ol style="list-style-type: none; margin: 0; padding: 0;">' .. links .. '</ol>'
return body
end
return p