-- This module implements {{FeaturedTopicSum}}.localp={}localfunctionpagesInCategory(category)-- Gets the number of pages in a category. Counting pages in a category is-- expensive, so use pcall in case we are being used on pages with lots of-- expensive function calls.localsuccess,noPages=pcall(mw.site.stats.pagesInCategory,category,'pages')returnsuccessandnoPagesor0endfunctionp.status(topic)ifnottopicthenerror('no topic specified',2)endlocalbaseCategory='موضوع برگزیده '..topiclocalnoGood=pagesInCategory('محتوای خوب در '..baseCategory)localnoFeatured=pagesInCategory('محتوای برگزیده در '..baseCategory)localnoOther=pagesInCategory(baseCategory)-- For a topic to be featured:-- 1) it must contain at least two featured articles, and-- 2) 50% or more of its articles must be featured.-- If either of these criteria are not met, the topic is assumed to be a-- good topic.ifnoFeatured>=2andnoFeatured>=(noGood+noOther)thenreturn'FT'elsereturn'GT'endendfunctionp._main(args)localstatus=p.status(args[1])ifstatus=='FT'thenreturnargs[2]elsereturnargs[3]endendfunctionp.main(frame)localargs=require('Module:Arguments').getArgs(frame,{wrappers='Template:FeaturedTopicSum'})returnp._main(args)endreturnp