יחידה:ParamValidator: הבדלים בין גרסאות בדף
תוכן שנמחק תוכן שנוסף
מוויקיפדיה |
ניסוי |
||
שורה 184:
local templatedata = readTemplateData( td_source )
local td_params = templatedata and templatedata.params
local all_aliases, all_series = {}, {}
if not td_params then return { ['no-templatedata'] = { [''] = '' } } end
שורה 197:
end end
for p_name, p in pairs( td_params ) do if p.series then
all_series[p_name] = tonumber(p.series) and p -- for now, only numeric values supported
end end
-- handle undeclared and deprecated
local already_seen = {}
שורה 202 ⟵ 206:
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 then -- 2nd chance. check to see if series
for s_name, p in pairs(all_series) do
if p and mw.ustring.match( p_name, '^' .. s_name .. '%d+' .. '$') then td_param = p end -- don't bother breaking. td always correct.
end
end
if not tp_param then -- not in TD: this is called undeclared
|