<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AFeaturedTopicSum</id>
	<title>Module:FeaturedTopicSum - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AFeaturedTopicSum"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:FeaturedTopicSum&amp;action=history"/>
	<updated>2026-05-05T21:26:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:FeaturedTopicSum&amp;diff=136153&amp;oldid=prev</id>
		<title>imported&gt;Mr. Stradivarius: Protected Module:FeaturedTopicSum: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:FeaturedTopicSum&amp;diff=136153&amp;oldid=prev"/>
		<updated>2015-01-12T16:50:25Z</updated>

		<summary type="html">&lt;p&gt;Protected Module:FeaturedTopicSum: &lt;a href=&quot;/index.php?title=WP:High-risk_templates&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:High-risk templates (page does not exist)&quot;&gt;High-risk Lua module&lt;/a&gt; ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{FeaturedTopicSum}}.&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local function pagesInCategory(category)&lt;br /&gt;
	-- Gets the number of pages in a category. Counting pages in a category is&lt;br /&gt;
	-- expensive, so use pcall in case we are being used on pages with lots of&lt;br /&gt;
	-- expensive function calls.&lt;br /&gt;
	local success, noPages = pcall(&lt;br /&gt;
		mw.site.stats.pagesInCategory,&lt;br /&gt;
		category,&lt;br /&gt;
		&amp;#039;pages&amp;#039;&lt;br /&gt;
	)&lt;br /&gt;
	return success and noPages or 0&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.status(topic)&lt;br /&gt;
	if not topic then&lt;br /&gt;
		error(&amp;#039;no topic specified&amp;#039;, 2)&lt;br /&gt;
	end&lt;br /&gt;
	local baseCategory = &amp;#039;Wikipedia featured topics &amp;#039; .. topic&lt;br /&gt;
	local noGood = pagesInCategory(baseCategory .. &amp;#039; good content&amp;#039;)&lt;br /&gt;
	local noFeatured = pagesInCategory(baseCategory .. &amp;#039; featured content&amp;#039;)&lt;br /&gt;
	local noOther = pagesInCategory(baseCategory)&lt;br /&gt;
&lt;br /&gt;
	-- For a topic to be featured:&lt;br /&gt;
	-- 1) it must contain at least two featured articles, and&lt;br /&gt;
	-- 2) 50% or more of its articles must be featured.&lt;br /&gt;
	-- If either of these criteria are not met, the topic is assumed to be a&lt;br /&gt;
	-- good topic.&lt;br /&gt;
	if noFeatured &amp;gt;= 2 and noFeatured &amp;gt;= (noGood + noOther) then&lt;br /&gt;
		return &amp;#039;FT&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;#039;GT&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._main(args)&lt;br /&gt;
	local status = p.status(args[1])&lt;br /&gt;
	if status == &amp;#039;FT&amp;#039; then&lt;br /&gt;
		return args[2]&lt;br /&gt;
	else&lt;br /&gt;
		return args[3]&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	local args = require(&amp;#039;Module:Arguments&amp;#039;).getArgs(frame, {&lt;br /&gt;
		wrappers = &amp;#039;Template:FeaturedTopicSum&amp;#039;&lt;br /&gt;
	})&lt;br /&gt;
	return p._main(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Mr. Stradivarius</name></author>
	</entry>
</feed>