This is an old revision of this page, as edited by Izno(talk | contribs) at 16:46, 7 May 2021(in fact, we can move that in here). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.Revision as of 16:46, 7 May 2021 by Izno(talk | contribs)(in fact, we can move that in here)
This module is rated as ready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing.
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 resuls to the output tableslocalres={}if#values>0thenlocalpreview=frame.args['preview']or'Page using [['..frame:getParent():getTitle()..']] with deprecated parameter _VALUE_'localdeprecated=frame.args['category']ifisnotempty(preview)thenpreview='<div class="hatnote" style="color:red"><strong>Warning:</strong> '..preview..' (this message is shown only in preview).</div>'endifframe:preprocess("{{REVISIONID}}")==""thendeprecated=previewfork,vinpairs(values)doifv==''then-- Fix odd bug for | = which gets stripped to the empty string and-- breaks category linksv=' 'endlocalr=deprecated:gsub('_VALUE_',('"'..v..'". replace with "'..dep_values[v]..'"'))table.insert(res,r)endelsefork,vinpairs(values)dolocalr=deprecated:gsub('_VALUE_',v)table.insert(res,r)endendendreturntable.concat(res)endreturnp