Open main menu

Documentation for this module may be created at Module:Catwithfiles/doc

local function get(frame)
	local args = frame.args
	local which = mw.site.stats.pagesInCategory( args[1], "*" )
	local r
	--[=[
	table#1 {
	  ["all"] = 289,
	  ["files"] = 231,
	  ["pages"] = 4,
	  ["subcats"] = 54
	}
	]=]

	if which.all == 0 then
		r = args[2].."0!"
	elseif which.files == 0 then
		r = " –"
	elseif which.files == tonumber(args[3]) then
		r = args[2].."("..args[3]..")"
	else
		r =  "<b>"..args[2]..args[3].." ".. which.files .."</b>"
	end
	return "[[:Category:"..args[1].."|"..r.."]]"
end

return { get = get }