This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing.
Module:Check for deprecated parameters may be appended to a template to check for uses of deprecated parameters. It will place the page in a specific category, and display a preview message, when it finds deprecated parameter uses.
Note: due to the nature of deprecations, this module will often have no templates implementing it.
-- 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-- on the listlocalp={}localfunctiontrim(s)returns:match('^%s*(.-)%s*$')endlocalfunctionisnotempty(s)returnsandtrim(s)~=''endfunctionp.check(frame)-- create the table of deprecated values and their matching new valuelocalargs=frame.argslocaldep_values={}fork,vinpairs(args)doifk=='ignoreblank'ork=='preview'ork=='deprecated'thenelsedep_values[k]=vendend-- loop over the parent args and see if any are deprecatedlocalvalues={}localignoreblank=isnotempty(frame.args['ignoreblank'])localpargs=frame:getParent().argsfork,vinpairs(pargs)doifignoreblankthenifdep_values[k]andv~=''thentable.insert(values,k)endelseifdep_values[k]thentable.insert(values,k)endendend-- add results to the output tableslocalres={}if#values>0thenlocalpreview=frame.args['preview']or'Page using [['..frame:getParent():getTitle()..']] with deprecated parameter _VALUE_'ifisnotempty(preview)thenpreview=require('Module:If preview')._warning({preview})end-- Kind of dangerous to trust that this is never nil, but I guess it's-- preferable to display that the use of the module is broken rather than-- have some sort of tracking category for pages which have an unknown-- parent tracking template.localcategory=frame.args['category']fork,vinpairs(values)dolocalc=category:gsub('_VALUE_',v)table.insert(res,c)ifv==''then-- Fix odd bug for | = which gets stripped to the empty string-- and breaks category linksv=' 'endlocalp=preview:gsub('_VALUE_','"'..v..'". Replace with "'..dep_values[v]..'".')table.insert(res,p)endendreturntable.concat(res)endreturnp