Content deleted Content added
make a sandy box |
Simplifications |
||
(7 intermediate revisions by one other user not shown) | |||
Line 13:
function p.check (frame)
-- create the table of deprecated values and their matching new value▼
local args = frame.args
local pargs = frame:getParent().args▼
local ignoreblank = isnotempty(frame.args['ignoreblank'])▼
local deprecated = frame.args['category']▼
local preview = frame.args['preview'] or 'Page using [['..frame:getParent():getTitle()..']] with deprecated parameter _VALUE_'▼
local dep_values = {}
local values = {}▼
local res = {}▼
▲ -- create the table of deprecated values and their matching new value
for k, v in pairs(args) do
if not (k == 'ignoreblank' or k == 'preview' or k == 'deprecated') then
dep_values[k] = v
end
end
-- loop over the parent args and see if any are deprecated
▲ local values = {}
▲ local ignoreblank = isnotempty(frame.args['ignoreblank'])
▲ local pargs = frame:getParent().args
for k, v in pairs(pargs) do
if dep_values[k] and (ignoreblank or v ~= '') then
if dep_values[k] and v~='' then▼
▲ table.insert(values, k)
end▼
table.insert(values, k)▼
end
end
-- add
▲ local res = {}
▲
for k, v in pairs(values) do▼
preview = require('Module:If preview')._warning({
-- Fix odd bug for | = which gets stripped to the empty string and▼
preview
-- breaks category links▼
-- Kind of dangerous to trust that this is never nil, but I guess it's
local r = deprecated:gsub('_VALUE_', ('"'..v..'". replace with "'..dep_values[v]..'"'))▼
-- preferable to display that the use of the module is broken rather than
table.insert(res, r)▼
-- have some sort of tracking category for pages which have an unknown
-- parent tracking template.
v = ' '
end
local p = preview:gsub(
'_VALUE_',
end
end
|