Изменения
учёт параметра _u, уточнение обработки spaced
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 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 ''
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
((ru:uc(currentTitle) ~= currentTitle and -- названия со всеми заглавными буквами
not mw.ustring.match(currentTitle, '^[А-Яа-яA-Za-z]+:?[А-ЯA-Z]') -- Книга:Литературное наследство, TranslateDate
) or
#currentTitle == 1
)
then
then
tname = lang:lcfirst(currentTitle)
tname = ru:lcfirst(currentTitle)
else
else
tname = currentTitle
tname = currentTitle
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)