Изменения
локализация наименований параметров из Модуль:Navbox/песочница
local imageleft
local imageleft
local imageleftstyle
local imageleftstyle
local style
local groupwidth
local listpadding
local bodyclass
local titleclass
local aboveclass
local belowclass
local groupclass
local listclass
local imageclass
local listnums = {}
local listnums = {}
-- also no show/hide link, then we need a spacer on the right to achieve the left shift.
-- also no show/hide link, then we need a spacer on the right to achieve the left shift.
if args.state == 'plain' then spacerSide = 'right' end
if args.state == 'plain' then spacerSide = 'right' end
elseif args.navbar == 'plain' or (not name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', '') == 'Шаблон:Навигационная таблица') then
elseif args.navbar == 'plain' or (not name and mw.getCurrentFrame():getParent():getTitle():gsub('/песочница$', '') == 'Шаблон:Навигационная таблица') then
-- No navbar. Need a spacer on the left to balance out the width of the show/hide link.
-- No navbar. Need a spacer on the left to balance out the width of the show/hide link.
if args.state ~= 'plain' then spacerSide = 'left' end
if args.state ~= 'plain' then spacerSide = 'left' end
titleCell
titleCell
:tag('div')
:tag('div')
:addClass(args.titleclass)
:addClass(titleclass)
:css('font-size', '114%')
:css('font-size', '114%')
:wikitext(addNewline(maintitle))
:wikitext(addNewline(maintitle))
:tag('td')
:tag('td')
:addClass('navbox-abovebelow')
:addClass('navbox-abovebelow')
:addClass(args.aboveclass)
:addClass(aboveclass)
:cssText(basestyle)
:cssText(basestyle)
:cssText(abovestyle)
:cssText(abovestyle)
:tag('td')
:tag('td')
:addClass('navbox-abovebelow')
:addClass('navbox-abovebelow')
:addClass(args.belowclass)
:addClass(belowclass)
:cssText(basestyle)
:cssText(basestyle)
:cssText(belowstyle)
:cssText(belowstyle)
:tag('td')
:tag('td')
:addClass('navbox-image')
:addClass('navbox-image')
:addClass(args.imageclass)
:addClass(imageclass)
:css('width', '1%')
:css('width', '1%')
:css('padding', '0px 7px 0px 0px')
:css('padding', '0px 7px 0px 0px')
end
end
if (args['group' .. listnum] or args['заголовок' .. listnum]) then
if (args['group' .. listnum] or args['заголовок' .. listnum] or args['группа' .. listnum]) then
local groupCell = row:tag('th')
local groupCell = row:tag('th')
:attr('scope', 'row')
:attr('scope', 'row')
:addClass('navbox-group')
:addClass('navbox-group')
:addClass(args.groupclass)
:addClass(groupclass)
:cssText(basestyle)
:cssText(basestyle)
end
end
if args.groupwidth then
if groupwidth then
groupCell:css('width', args.groupwidth)
groupCell:css('width', groupwidth)
end
end
groupCell
groupCell
:cssText(groupstyle)
:cssText(groupstyle)
:cssText(args['group' .. listnum .. 'style'])
:cssText(args['group' .. listnum .. 'style'] or args['стиль_' .. listnum .. 'группы'])
:wikitext(args['group' .. listnum] or args['заголовок' .. listnum])
:wikitext(args['group' .. listnum] or args['заголовок' .. listnum] or args['группа' .. listnum])
end
end
local listCell = row:tag('td')
local listCell = row:tag('td')
if (args['group' .. listnum] or args['заголовок' .. listnum]) then
if (args['group' .. listnum] or args['заголовок' .. listnum] or args['группа' .. listnum]) then
listCell
listCell
:css('text-align', 'left')
:css('text-align', 'left')
end
end
if not args.groupwidth then
if not groupwidth then
listCell:css('width', '100%')
listCell:css('width', '100%')
end
end
:cssText(liststyle)
:cssText(liststyle)
:cssText(rowstyle)
:cssText(rowstyle)
:cssText(args['list' .. listnum .. 'style'])
:cssText(args['list' .. listnum .. 'style'] or args['стиль_' .. listnum .. 'списка'])
:addClass('navbox-list')
:addClass('navbox-list')
:addClass('navbox-' .. evenOdd)
:addClass('navbox-' .. evenOdd)
:addClass(args.listclass)
:addClass(listclass)
:tag('div')
:tag('div')
:css('padding', (listnum == 1 and args.list1padding) or args.listpadding or '0em 0.25em')
:css('padding', (listnum == 1 and args.list1padding) or listpadding or '0em 0.25em')
:wikitext('\n' .. (args['list' .. listnum] or args['список' .. listnum]))
:wikitext('\n' .. (args['list' .. listnum] or args['список' .. listnum]))
end
end
:tag('td')
:tag('td')
:addClass('navbox-image')
:addClass('navbox-image')
:addClass(args.imageclass)
:addClass(imageclass)
:css('width', '1%')
:css('width', '1%')
:css('padding', '0px 0px 0px 7px')
:css('padding', '0px 0px 0px 7px')
local function needsChangetoSubgroups()
local function needsChangetoSubgroups()
for i = 1, 23 do
for i = 1, 23 do
if (args['group' .. i] or args['заголовок' .. i]) and not (args['list' .. i] or args['список' .. i]) then
if (args['group' .. i] or args['заголовок' .. i]) or args['группа' .. i] and not (args['list' .. i] or args['список' .. i]) then
return true
return true
end
end
local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent', 'hlist hlist-items-nowrap', 'hlist-items-nowrap', 'wraplinks'}
local listClasses = {'plainlist', 'hlist', 'hlist hnum', 'hlist hwrap', 'hlist vcard', 'vcard hlist', 'hlist vevent', 'hlist hlist-items-nowrap', 'hlist-items-nowrap', 'wraplinks'}
for i, cls in ipairs(listClasses) do
for i, cls in ipairs(listClasses) do
if args.listclass == cls or args.bodyclass == cls then
if listclass == cls or bodyclass == cls then
return false
return false
end
end
if title.namespace ~= 10 then return end -- not in template space
if title.namespace ~= 10 then return end -- not in template space
local subpage = title.subpageText
local subpage = title.subpageText
if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
if subpage == 'doc' or subpage == 'песочница' or subpage == 'тесты' then return end
for i, cat in ipairs(getTrackingCategories()) do
for i, cat in ipairs(getTrackingCategories()) do
local tbl = mw.html.create('table')
local tbl = mw.html.create('table')
:addClass('nowraplinks')
:addClass('nowraplinks')
:addClass(args.bodyclass)
:addClass(bodyclass)
if maintitle and (args.state ~= 'plain' and args.state ~= 'off') then
if maintitle and (args.state ~= 'plain' and args.state ~= 'off') then
:addClass('navbox-subgroup')
:addClass('navbox-subgroup')
:cssText(bodystyle)
:cssText(bodystyle)
:cssText(args.style)
:cssText(style)
else -- regular navbox - bodystyle and style will be applied to the wrapper table
else -- regular navbox - bodystyle and style will be applied to the wrapper table
tbl
tbl
imageleftstyle = args.imageleftstyle or args.imagestyle2 or args['стиль_изображения_слева']
imageleftstyle = args.imageleftstyle or args.imagestyle2 or args['стиль_изображения_слева']
below = args.below or args['внизу']
below = args.below or args['внизу']
titlestyle = args.titlestyle or args['стиль_основного_заголовка']
titlestyle = args.titlestyle or args['стиль_основного_заголовка'] or args['стиль_заголовка']
groupstyle = args.groupstyle or args['стиль_заголовков']
groupstyle = args.groupstyle or args['стиль_заголовков'] or args['стиль_групп']
bodystyle = args.bodystyle or args['стиль_тела']
bodystyle = args.bodystyle or args['стиль_тела']
basestyle = args.basestyle or args['стиль']
basestyle = args.basestyle or args['стиль_базовый']
style = args.style or args['стиль']
liststyle = args.liststyle or args['стиль_списков']
liststyle = args.liststyle or args['стиль_списков']
oddstyle = args.oddstyle or args['стиль_нечетных']
oddstyle = args.oddstyle or args['стиль_нечетных'] or args['стиль_нечётных']
evenstyle = args.evenstyle or args['стиль_четных']
evenstyle = args.evenstyle or args['стиль_четных'] or args['стиль_чётных']
abovestyle = args.abovestyle or args['стиль_вверху']
abovestyle = args.abovestyle or args['стиль_вверху']
belowstyle = args.belowstyle or args['стиль_внизу']
belowstyle = args.belowstyle or args['стиль_внизу']
evenoddARG = args.evenodd or args['четные_нечетные']
evenoddARG = args.evenodd or args['четные_нечетные'] or args['чётные_нечётные']
groupwidth = args.groupwidth or args['ширина_групп']
listpadding = args.listpadding or args['отступ_списков']
bodyclass = args.bodyclass or args['класс_тела']
titleclass = args.titleclass or args['класс_заголовка']
aboveclass =args.aboveclass or args['класс_вверху']
belowclass = args.belowclass or args['класс_внизу']
groupclass = args.groupclass or args['класс_групп']
listclass = args.listclass or args['класс_списков']
imageclass = args.imageclass or args['класс_изображения']
-- render the main body of the navbox
-- render the main body of the navbox
local tbl = renderMainTable()
local tbl = renderMainTable()
:css('border-spacing', 0)
:css('border-spacing', 0)
:cssText(bodystyle)
:cssText(bodystyle)
:cssText(args.style)
:cssText(style)
:tag('tr')
:tag('tr')
:tag('td')
:tag('td')
getArgs = require('Module:Arguments').getArgs
getArgs = require('Module:Arguments').getArgs
end
end
args = getArgs(frame, {wrappers = 'Шаблон:Навигационная таблица'})
args = getArgs(frame, {wrappers = {'Шаблон:Навигационная таблица'}})
-- Read the arguments in the order they'll be output in, to make references number in the right order.
-- Read the arguments in the order they'll be output in, to make references number in the right order.
_ = above
_ = above
for i = 1, 23 do
for i = 1, 23 do
_ = args["group" .. tostring(i)] and args["заголовок" .. tostring(i)]
_ = args["group" .. tostring(i)] and args["заголовок" .. tostring(i)] and args["группа" .. tostring(i)]
_ = args["list" .. tostring(i)] and args["список" .. tostring(i)]
_ = args["list" .. tostring(i)] and args["список" .. tostring(i)]
end
end