Редактирование: Модуль:Sidebar
Перейти к навигации
Перейти к поиску
Примечание. Ваши правки будут показаны в статье только после их проверки участником с соответствующими правами.
Правка может быть отменена. Проверьте сравнение версий ниже и нажмите «Записать страницу».
Если отменяемые вами изменения не вандализм, пожалуйста, допишите причину в описании правки.
Текущая версия | Ваш текст | ||
Строка 1: | Строка 1: | ||
-- | -- | ||
-- | -- Этот модуль обеспечивает работу шаблона {{Sidebar}} | ||
-- | -- | ||
require(' | require('Модуль:No globals') | ||
local p = {} | local p = {} | ||
local getArgs = require(' | local getArgs = require('Модуль:Arguments').getArgs | ||
local navbar = require(' | local navbar = require('Модуль:Navbar')._navbar | ||
local function trimAndAddAutomaticNewline(s) | local function trimAndAddAutomaticNewline(s) | ||
Строка 19: | Строка 19: | ||
else | else | ||
return s | return s | ||
end | end | ||
end | end | ||
Строка 37: | Строка 29: | ||
local child = args.child and mw.text.trim(args.child) == 'yes' | local child = args.child and mw.text.trim(args.child) == 'yes' | ||
if not child then | if not child then | ||
root | root = root | ||
:tag('table') | |||
:addClass('vertical-navbox') | :addClass('vertical-navbox') | ||
:addClass(args.wraplinks ~= 'true' and 'nowraplinks' or nil) | :addClass(args.wraplinks ~= 'true' and 'nowraplinks' or nil) | ||
Строка 98: | Строка 90: | ||
:wikitext(args.pretitle) | :wikitext(args.pretitle) | ||
end | end | ||
end | end | ||
Строка 112: | Строка 97: | ||
root | root | ||
:wikitext(args.title) | :wikitext(args.title) | ||
:wikitext('</th></tr>') -- @todo replace this with unclosed again once mw.html gets it | |||
else | else | ||
root | root | ||
Строка 193: | Строка 179: | ||
:tag('td') | :tag('td') | ||
:addClass(args.contentclass) | :addClass(args.contentclass) | ||
:css('padding', | :css('padding', '0 0.1em 0.4em') | ||
:cssText(args.contentstyle) | :cssText(args.contentstyle) | ||
:cssText(args['content' .. num .. 'style']) | :cssText(args['content' .. num .. 'style']) | ||
Строка 217: | Строка 203: | ||
if not child then | if not child then | ||
local navbarArg = args.navbar or args.tnavbar | local navbarArg = args.navbar or args.tnavbar | ||
if navbarArg ~= 'none' and navbarArg ~= 'off' and (args.name or frame:getParent():getTitle():gsub('/sandbox$', '') ~= ' | if navbarArg ~= 'none' and navbarArg ~= 'off' and (args.name or frame:getParent():getTitle():gsub('/sandbox$', '') ~= 'Шаблон:Sidebar') then | ||
root | root | ||
:tag('tr') | :tag('tr') | ||
Строка 232: | Строка 218: | ||
end | end | ||
return tostring(root | return tostring(root) | ||
end | end | ||
Строка 241: | Строка 227: | ||
args.belowstyle = 'border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;' .. (args.belowstyle or '') | args.belowstyle = 'border-top: 1px solid #aaa; border-bottom: 1px solid #aaa;' .. (args.belowstyle or '') | ||
args.navbarstyle = 'padding-top: 0.6em;' .. (args.navbarstyle or args.tnavbarstyle or '') | args.navbarstyle = 'padding-top: 0.6em;' .. (args.navbarstyle or args.tnavbarstyle or '') | ||
if not args.name and frame:getParent():getTitle():gsub('/sandbox$', '') == ' | if not args.name and frame:getParent():getTitle():gsub('/sandbox$', '') == 'Шаблон:Sidebar with collapsible lists' then | ||
args.navbar = 'none' | args.navbar = 'none' | ||
end | end |