-- 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'])localshowblankpos=isnotempty(frame.args['showblankpositional'])localknownargs={}localunknown=frame.args['unknown']or'Found _VALUE_, 'localpreview=frame.args['preview']localvalues={}localres={}localregexps={}-- 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>Warning:</strong> '..preview..' (this message is shown only in preview).</div>'elseifpreview==nilthenpreview=unknownend-- 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\-_ ]','?')table.insert(values,k)endelseiftype(k)=='number'andknownargs[tostring(k)]==niland(showblankposorisnotempty(v))thenlocalvlen=mw.ustring.len(v)v=mw.ustring.sub(v,1,(vlen<25)andvlenor25)v=mw.ustring.gsub(v,'[^%w\-_ ]','?')table.insert(values,k..' = '..v..((vlen>=25)and' ...'or''))endend-- add resuls to the output tablesif#values>0thenifframe:preprocess("{REVISIONID}")==""thenunknown=previewendfork,vinpairs(values)doifv==''then-- Fix odd bug for | = which gets stripped to the empty string and-- breaks category linksv=' 'endlocalr=unknown:gsub('_VALUE_',v)table.insert(res,r)endendreturntable.concat(res)endreturnp