Изменения

Перейти к навигации Перейти к поиску
обновление логики для отсутствующего первого параметра из Модуль:Example
Строка 69: Строка 69:  
end
 
end
 
 
if tname == '' or tname == nil then  -- при отсутствующем имени шаблона берём его из названия страницы
+
if tname == '' or tname == nil then  -- при опущенном первом параметре берём имя шаблона из названия страницы
tname = mw.language.new('ru'):lcfirst(mw.title.getCurrentTitle().rootText)
+
local lang = mw.language.new('ru')
 +
local currentTitle = mw.title.getCurrentTitle().rootText
 +
if (lang:uc(currentTitle) ~= currentTitle and
 +
not mw.ustring.match(currentTitle, '[а-я]:[А-Я]')  -- Книга:Литературное наследие
 +
) or
 +
#currentTitle == 1
 +
then
 +
tname = mw.language.new('ru'):lcfirst(currentTitle)
 +
else
 +
tname = currentTitle
 +
end
 
end
 
end
 
 
Анонимный участник

Реклама:

Навигация