-- This module implements {{cat main}}.localmHatnote=require('Module:Hatnote')localyesno=require('Module:Yesno')localmTableTools-- lazily initialiselocalmArguments-- lazily initialiselocalp={}functionp.catMain(frame)mTableTools=require('Module:TableTools')mArguments=require('Module:Arguments')localargs=mArguments.getArgs(frame,{wrappers='Template:Cat main'})localpages=mTableTools.compressSparseArray(args)localoptions={article=args.article,selfref=args.selfref}returnp._catMain(options,unpack(pages))endfunctionp._catMain(options,...)options=optionsor{}-- Get the links table.locallinks=mHatnote.formatPages(...)ifnotlinks[1]thenlocalpage=mw.title.getCurrentTitle().textlinks[1]=mHatnote._formatLink(page)endfori,linkinipairs(links)dolinks[i]=string.format("'''%s'''",link)end-- Get the pagetype.localpagetypeifyesno(options.article)~=falsethenpagetype='article'elsepagetype='page'end-- Work out whether we need to be singular or plural.localstringToFormatif#links>1thenstringToFormat='यस [[Help:Categories|श्रेणी]] को लागि मुख्य लेखहरू %s।'elsestringToFormat=' यस [[Help:Categories|श्रेणी]]का मुख्य लेखहरू %s हुन् ।'end-- Get the text.localtext=string.format(stringToFormat,pagetype,mw.text.listToText(links))-- Pass it through to Module:Hatnote.localhnOptions={}hnOptions.selfref=options.selfrefhnOptions.extraclasses='relarticle mainarticle'returnmHatnote._hatnote(text,hnOptions)endreturnp