יחידה:ParamValidator: הבדלים בין גרסאות בדף

תוכן שנמחק תוכן שנוסף
יותר מדויק
כמקובל
שורה 169:
-- if second parameter is nil, only tempalte page will be searched for templatedata.
function calculateViolations( frame, subpages )
 
-- used for parameter type validy test. keyed by TD 'type' string. values are function(val) returning bool.
local type_validators = {
שורה 199 ⟵ 198:
-- handle undeclared and deprecated
local already_seen = {}
local series = frame.args['series']
for p_name, value in pairs( t_args ) do
local tp_param, noval, numeric, table_name = td_params[p_name] or all_aliases[p_name], util.empty( value ), tonumber( p_name )
local hasval = not noval
 
if not tp_param and frame.args['series'] then -- 2nd chance. check to see if series
for s_name, p in pairs(td_params) do
if mw.ustring.match( p_name, '^' .. s_name .. '%d+' .. '$') then td_param = p end -- don't bother breaking. td always correct.
-- mw.log('found p_name '.. p_name .. ' s_name:' .. s_name, ' p is:', p) debugging series support
tp_param = p
end -- don't bother breaking. td always correct.
end
end
שורה 220 ⟵ 223:
or tp_param.deprecated and noval and 'empty-deprecated'
or not compatible( tp_param.type, value ) and 'incompatible'
or not series and already_seen[tp_param] and hasval and 'duplicate'
already_seen[tp_param] = hasval