Изменения

Перейти к навигации Перейти к поиску
обработка некорректных символов в названии; оф
Строка 76: Строка 76:  
end
 
end
   −
local page_title = mw.title.new(args[1])
+
local ru_page = mw.title.new(args[1])
if leave_if_redirect and not page_title.isRedirect then
+
if ru_page == nil then
 +
if allow_cat then
 +
categories = categories .. orphan_categories['error']
 +
end
 +
return error{'некорректные символы в названии статьи'} .. categories
 +
end
 +
if leave_if_redirect and not ru_page.isRedirect then
 
leave_if_redirect = false
 
leave_if_redirect = false
 
end
 
end
local exists = page_title.exists and not ( leave_always or leave_if_redirect )
+
local exists = ru_page.exists and not ( leave_always or leave_if_redirect )
 
if leave_if_redirect and allow_cat then
 
if leave_if_redirect and allow_cat then
 
categories = categories .. orphan_categories['redirect']
 
categories = categories .. orphan_categories['redirect']
Строка 114: Строка 120:  
if is_empty(iw_text) then
 
if is_empty(iw_text) then
 
iw_text = iw_title
 
iw_text = iw_title
 +
end
 +
 +
local iw_page = mw.title.new(iw_title)
 +
if iw_page == nil then
 +
if allow_cat then
 +
categories = categories .. orphan_categories['error']
 +
end
 +
return error{'некорректные символы в названии статьи'} .. categories
 
end
 
end
 
 
Строка 135: Строка 149:  
 
 
local tooltip
 
local tooltip
title = mw.getContentLanguage():ucfirst(title)
+
local ucfirst_title = mw.getContentLanguage():ucfirst(title)
 
if lang == 'd' then
 
if lang == 'd' then
tooltip = string.format('Элемент статьи «%s» в Викиданных', title)
+
tooltip = string.format('Элемент статьи «%s» в Викиданных', ucfirst_title)
 
else
 
else
tooltip = string.format('Версия статьи «%s» на %s', title, prepositional(lang))
+
tooltip = string.format('Версия статьи «%s» на %s', ucfirst_title, prepositional(lang))
 
end
 
end
 
 
Анонимный участник

Реклама:

Навигация