Изменения

Перейти к навигации Перейти к поиску
учёт параметра _u, уточнение обработки spaced
Строка 62: Строка 62:  
local tag = args._tag
 
local tag = args._tag
 
local container = args._container or nil
 
local container = args._container or nil
 +
local ucFirst = yesno(args._u, false)
 +
local link = yesno(args._link, false)
 
local sep = args._sep and args._sep .. ' '
 
local sep = args._sep and args._sep .. ' '
local link = yesno(args._link, false)
   
local endl = args._endl or ''
 
local endl = args._endl or ''
 
local prefix = args._prefix or args['_pre-text'] or ''
 
local prefix = args._prefix or args['_pre-text'] or ''
Строка 150: Строка 151:  
end
 
end
 
if tname == '' or tname == nil then  -- при опущенном первом параметре берём имя шаблона из названия страницы
 
if tname == '' or tname == nil then  -- при опущенном первом параметре берём имя шаблона из названия страницы
local lang = mw.language.new('ru')
+
local ru = mw.language.new('ru')
 
local currentTitle = mw.title.getCurrentTitle().rootText
 
local currentTitle = mw.title.getCurrentTitle().rootText
if (lang:uc(currentTitle) ~= currentTitle and  -- названия со всеми заглавными буквами
+
if not ucFirst and
not mw.ustring.match(currentTitle, '^[А-Яа-яA-Za-z]+:?[А-ЯA-Z]')  -- Книга:Литературное наследство, TranslateDate
+
((ru:uc(currentTitle) ~= currentTitle and  -- названия со всеми заглавными буквами
) or
+
not mw.ustring.match(currentTitle, '^[А-Яа-яA-Za-z]+:?[А-ЯA-Z]')  -- Книга:Литературное наследство, TranslateDate
#currentTitle == 1
+
) or
 +
#currentTitle == 1
 +
)
 
then
 
then
tname = lang:lcfirst(currentTitle)
+
tname = ru:lcfirst(currentTitle)
 
else
 
else
 
tname = currentTitle
 
tname = currentTitle
Строка 198: Строка 201:  
content = content .. (spaced and ' ' or '') .. '|' .. nowiki(k) .. '=' .. nowiki(v) .. endl
 
content = content .. (spaced and ' ' or '') .. '|' .. nowiki(k) .. '=' .. nowiki(v) .. endl
 
end
 
end
 +
end
 +
if spaced then
 +
content = content .. ' '
 
end
 
end
 
content = content .. '}}' .. nowiki(postfix)
 
content = content .. '}}' .. nowiki(postfix)
Анонимный участник

Реклама:

Навигация