Изменения

нет описания правки
Строка 50: Строка 50:  
}
 
}
 
local mode = tonumber(args['mode'])
 
local mode = tonumber(args['mode'])
 +
 +
local redundant_params = {}
 +
local good_params = {'mode', 1, 2, 3, 4, 'l', 'leave', 'r', 'q', 'nocat'}
 +
if mode == 2 then
 +
table.insert(good_params, 5)
 +
table.insert(good_params, 'text')
 +
table.insert(good_params, 'текст')
 +
end
 +
for k, _ in pairs(args) do
 +
local is_good_param = false
 +
for _, v in pairs(good_params) do
 +
  if k == v then
 +
  is_good_param = true
 +
  end
 +
end
 +
if not is_good_param then
 +
table.insert(redundant_params, k)
 +
end
 +
end
 +
if allow_cat and #redundant_params > 0 then
 +
categories = categories .. '[[Категория:Википедия:Статьи с неизвестными параметрами шаблонов серии Не переведено]]'
 +
if frame:preprocess('{{REVISIONID}}') == '' then
 +
categories = categories .. '<span class="error">Лишние параметры ' .. mw.text.listToText(redundant_params) .. '</span>'
 +
end
 +
end
    
local title = args[1]
 
local title = args[1]
Строка 56: Строка 81:  
local iw_title = args[4]
 
local iw_title = args[4]
 
local iw_text = args[5]
 
local iw_text = args[5]
  −
if args[1]:match('^:[a-z-]+:') then
  −
if allow_cat then
  −
categories = categories .. '[[Категория:Страницы с полустарым синтаксисом в шаблоне «не переведено»]]'
  −
end
  −
return error{'шаблон не поддерживает такой синтаксис'} .. categories
  −
end
   
 
 
if mw.isSubsting() and mode ~= 2 then
 
if mw.isSubsting() and mode ~= 2 then
Строка 73: Строка 91:  
end
 
end
 
return error{'не указано название статьи'} .. categories
 
return error{'не указано название статьи'} .. categories
 +
end
 +
if title:match('^:[a-z-]+:') then
 +
if allow_cat then
 +
categories = categories .. '[[Категория:Википедия:Статьи с полустарым синтаксисом в шаблонах серии Не переведено]]'
 +
end
 +
return error{'шаблон не поддерживает такой синтаксис'} .. categories
 
end
 
end
 
if is_empty(text) then
 
if is_empty(text) then
Анонимный участник