Content deleted Content added
Zackmann08 (talk | contribs) No edit summary |
use if preview |
||
(4 intermediate revisions by 2 users 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 deprecated = frame.args['category'] or 'Found _VALUE_, '▼
local preview = frame.args['preview'] or 'Found _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 k == 'ignoreblank' or k == 'preview' or k == 'deprecated' then else
dep_values[k] = v
end
end▼
if isnotempty(preview) then ▼
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
table.insert(values, k)
end▼
else▼
if dep_values[k] then
end
end
end
-- add
▲ local res = {}
if #values > 0 then
'Page using [['..frame:getParent():getTitle()..']] with deprecated parameter _VALUE_'
deprecated = preview▼
for k, v in pairs(values) do▼
preview = require('Module:If preview')._warning({
▲ if v == '' then
preview
-- Fix odd bug for | = which gets stripped to the empty string and▼
-- breaks category links▼
-- 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.
if v == '' then
▲ -- and breaks category links
v = ' '
▲ end
local r = deprecated:gsub('_VALUE_', ('"'..v..'". replace with "'..dep_values[v]..'"'))▼
▲ table.insert(res, r)
▲ end
▲ else
▲ local r = deprecated:gsub('_VALUE_', v)
▲ table.insert(res, r)
end
'_VALUE_',
)
table.insert(res, p )
end
end
|