-- This module may be used to compare the arguments passed to the parent-- with a list of arguments, returning a specified result if an argument is-- not on the listlocalp={}localfunctiontrim(s)returns:match('^%s*(.-)%s*$')endlocalfunctionisnotempty(s)returnsandtrim(s)~=''endfunctionp.check(frame)localargs=frame.argslocalpargs=frame:getParent().argslocalignoreblank=isnotempty(frame.args['ignoreblank'])localcheckpos=isnotempty(frame.args['checkpositional'])localknownargs={}localunknown=frame.args['unknown']or'Found _VALUE_, 'localpreview=frame.args['preview']localres={}localregexps={}localcomments={}localcommentstr=''localispreview=frame:preprocess("{{REVISIONID}}")==""and1or0-- create the list of known args, regular expressions, and the return stringfork,vinpairs(args)doiftype(k)=='number'thenv=trim(v)knownargs[v]=1elseifk:find('^regexp[1-9][0-9]*$')thentable.insert(regexps,'^'..v..'$')endendifisnotempty(preview)thenpreview='<div class="hatnote" style="color:red"><strong>Hişyarî:</strong> '..preview..' (ev peyvam tenê di pêşdîtinê de tê nîşankirin).</div>'elseifpreview==nilthenpreview=unknownendifispreview==1thenunknown=previewignoreblank=falseend-- adds one result to the output tableslocalfunctionaddresult(k)ifk==''then-- Fix odd bug for | = which gets stripped to the empty string and-- breaks category linksk=' 'endlocalr=unknown:gsub('_VALUE_',k)table.insert(res,r)table.insert(comments,'"'..k..'"')end-- loop over the parent args, and make sure they are on the listfork,vinpairs(pargs)doiftype(k)=='string'andknownargs[k]==nilthenlocalknownflag=falsefori,regexpinipairs(regexps)doifmw.ustring.match(k,regexp)thenknownflag=truebreakendendifnotknownflagand(notignoreblankorisnotempty(v))thenk=mw.ustring.gsub(k,'[^%w\-_ ]','?')addresult(k)endelseifcheckposandtype(k)=='number'andknownargs[tostring(k)]==niland(notignoreblankorisnotempty(v))thenaddresult(k)endendif#comments>0thencommentstr='<!-- Module:Check for unknown parameters results: '..table.concat(comments,', ')..'-->'endreturntable.concat(res)..commentstrendreturnp