<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ar">
	<id>https://www.copticpedia.org/index.php?action=history&amp;feed=atom&amp;title=%D9%88%D8%AD%D8%AF%D8%A9%3ANUMBEROF</id>
	<title>وحدة:NUMBEROF - تاريخ المراجعة</title>
	<link rel="self" type="application/atom+xml" href="https://www.copticpedia.org/index.php?action=history&amp;feed=atom&amp;title=%D9%88%D8%AD%D8%AF%D8%A9%3ANUMBEROF"/>
	<link rel="alternate" type="text/html" href="https://www.copticpedia.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:NUMBEROF&amp;action=history"/>
	<updated>2026-04-19T15:20:15Z</updated>
	<subtitle>تاريخ التعديل لهذه الصفحة في الويكي</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://www.copticpedia.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:NUMBEROF&amp;diff=1772&amp;oldid=prev</id>
		<title>Gerges: مراجعتان</title>
		<link rel="alternate" type="text/html" href="https://www.copticpedia.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:NUMBEROF&amp;diff=1772&amp;oldid=prev"/>
		<updated>2021-03-14T14:11:49Z</updated>

		<summary type="html">&lt;p&gt;مراجعتان&lt;/p&gt;
&lt;p&gt;&lt;b&gt;صفحة جديدة&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local function trimArg(arg, i)&lt;br /&gt;
	arg = mw.text.trim(arg or '')&lt;br /&gt;
	if arg == '' then&lt;br /&gt;
		if i then&lt;br /&gt;
			error('Parameter ' .. i .. ' is missing. See template documentation')&lt;br /&gt;
		end&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	return mw.ustring.lower(arg)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getValue(stats, action, map)&lt;br /&gt;
	if action == 'depth' then&lt;br /&gt;
		-- https://meta.wikimedia.org/wiki/Wikipedia_article_depth&lt;br /&gt;
		-- This gives silly results if, for example, the number of articles is small.&lt;br /&gt;
		local n = { 'articles', 'edits', 'pages' }&lt;br /&gt;
		if map then&lt;br /&gt;
			for i, v in ipairs(n) do&lt;br /&gt;
				n[i] = map[v]&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		for i, v in ipairs(n) do&lt;br /&gt;
			n[i] = stats[v] or 0&lt;br /&gt;
		end&lt;br /&gt;
		local articles, edits, pages = n[1], n[2], n[3]&lt;br /&gt;
		if pages == 0 or articles == 0 then&lt;br /&gt;
			return 0&lt;br /&gt;
		end&lt;br /&gt;
		return math.floor((edits/pages) * ((pages - articles)/articles)^2)&lt;br /&gt;
	end&lt;br /&gt;
	if map then&lt;br /&gt;
		action = map[action]&lt;br /&gt;
	end&lt;br /&gt;
	return stats[action]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getIfLocal(site, action)&lt;br /&gt;
	-- If wanted site is the local site where module is running,&lt;br /&gt;
	-- return numberof result for given action, or nil.&lt;br /&gt;
	-- This is faster than reading the cached table, and gives the current value.&lt;br /&gt;
	local localSite = string.match(mw.site.server, '.*//(.*)%.org$')  -- examples: 'af.wikipedia', 'commons.wikimedia'&lt;br /&gt;
	if site == localSite then&lt;br /&gt;
		if action == 'activeusers' then&lt;br /&gt;
			action = 'activeUsers'&lt;br /&gt;
		end&lt;br /&gt;
		return getValue(mw.site.stats, action)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function main(frame)&lt;br /&gt;
	local args = frame:getParent().args&lt;br /&gt;
	local action = trimArg(args[1], 1)  -- activeusers, admins, articles, edits, files, pages, users, depth&lt;br /&gt;
	if action:sub(1, 8) == 'numberof' then  -- numberofX is an alias for X&lt;br /&gt;
		action = trimArg(action:sub(9), 1)&lt;br /&gt;
	end&lt;br /&gt;
	local site = trimArg(args[2], 2)  -- &amp;quot;af&amp;quot; or &amp;quot;af.wikipedia&amp;quot; or &amp;quot;af.wikiquote&amp;quot; etc., including &amp;quot;total&amp;quot;&lt;br /&gt;
	if not site:find('.', 1, true) then&lt;br /&gt;
		site = site .. '.wikipedia'&lt;br /&gt;
	end&lt;br /&gt;
	local wantComma = trimArg(args[3])  -- nil for no commas in output; &amp;quot;N&amp;quot; or anything nonblank inserts commas&lt;br /&gt;
	local result = getIfLocal(site, action)&lt;br /&gt;
	if not result then&lt;br /&gt;
		local data = mw.loadData('Module:NUMBEROF/data')&lt;br /&gt;
		local map = data.map&lt;br /&gt;
		data = data.data&lt;br /&gt;
		result = data[site]&lt;br /&gt;
		if result then&lt;br /&gt;
			result = getValue(result, action, map)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if result then&lt;br /&gt;
		if wantComma then&lt;br /&gt;
			result = mw.getContentLanguage():formatNum(result)&lt;br /&gt;
		end&lt;br /&gt;
		return result  -- number or formatted string&lt;br /&gt;
	end&lt;br /&gt;
	return -1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function rank(frame)&lt;br /&gt;
	-- Rank sites in a specified sister project by their number of articles.&lt;br /&gt;
	local args = frame:getParent().args&lt;br /&gt;
	local parm = trimArg(args[1], 1)  -- a number like 12 or a site name like &amp;quot;af&amp;quot; (not &amp;quot;af.wikipedia&amp;quot;)&lt;br /&gt;
	local base = trimArg(args[2]) or 'wikipedia'  -- base of full site name like &amp;quot;wikipedia&amp;quot; or &amp;quot;wikiquote&amp;quot;&lt;br /&gt;
	local wantComma = trimArg(args[3])&lt;br /&gt;
	local data = mw.loadData('Module:NUMBEROF/' .. (base == 'wikipedia' and 'rank' or 'other'))&lt;br /&gt;
	data = data[base]&lt;br /&gt;
	if data then&lt;br /&gt;
		local result&lt;br /&gt;
		parm = tonumber(parm) or parm&lt;br /&gt;
		if type(parm) == 'number' then&lt;br /&gt;
			result = data.rankByIndex[parm]&lt;br /&gt;
		else&lt;br /&gt;
			result = data.rankBySite[parm]&lt;br /&gt;
			if result and wantComma then&lt;br /&gt;
				result = mw.getContentLanguage():formatNum(result)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if result then&lt;br /&gt;
			return result  -- number or string&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return -1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	main = main,&lt;br /&gt;
	rank = rank,&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Gerges</name></author>
	</entry>
</feed>