-- module reproduisant le comportement de {{PAGESINCATEGORY}}-- sans le buglocalp={}-- génère une erreurfunctionp.erreur(texte)return'<span class="error">'..(texteor"''aucune erreur indiquée''").."</span>"end-- pour tester la fonctionnalité "pageincategory"functionp.pagesincat(frame)-- le nom de la catégorielocalargs=frame:getParent().argslocalcat=args[1]-- le type de demandelocalarg=frame.args["type"]orargs["type"]-- mise en forme des nombres ?localmef=args["mise en forme"]localsel-- la sélection-- en l'absence de nom de catégorie on utilise la page couranteif(cat==nilorcat=="")thenlocaltitre=mw.title.getCurrentTitle()-- on vérifie qu'on est une catégorieif(titre.namespace~=14)thenreturnp.erreur("Без назвы стану і бягучая старонка не зьяўляецца катэгорыяй")end-- on utilise le titre de la page courantecat=mw.title.getCurrentTitle().textend-- on regarde le paramètreif(arg=="all"orarg==nilorarg=="*")thensel="all"elseif(arg=="cats")thensel="subcats"elseif(arg=="files")thensel="files"elseif(arg=="pages")thensel="pages"elsereturnp.erreur("парамэтр '"..(argor"<nil>").."' не падтрымлівае")endlocalres=mw.site.stats.pagesInCategory(cat,sel)if(res==nil)thenreturnp.erreur("erreur de récupération des informations")end-- si mise en forme on appliqueif(mef~=nil)thenreturnmw.getContentLanguage():formatNum(res)elsereturntostring(res)endendreturnp