영문위키 en:Module:Sidebar
편집 요약 없음 |
(영문위키 en:Module:Sidebar) |
||
19번째 줄: | 19번째 줄: | ||
else | else | ||
return s | return s | ||
end | |||
end | |||
local function hasSubgroup(s) | |||
if mw.ustring.find(s, 'vertical%-navbox%-subgroup') then | |||
return true | |||
else | |||
return false | |||
end | end | ||
end | end | ||
29번째 줄: | 37번째 줄: | ||
local child = args.child and mw.text.trim(args.child) == 'yes' | local child = args.child and mw.text.trim(args.child) == 'yes' | ||
root = root:tag('table') | |||
if not child then | if not child then | ||
root | root | ||
:addClass('vertical-navbox') | :addClass('vertical-navbox') | ||
:addClass(args.wraplinks ~= 'true' and 'nowraplinks' or nil) | :addClass(args.wraplinks ~= 'true' and 'nowraplinks' or nil) | ||
90번째 줄: | 98번째 줄: | ||
:wikitext(args.pretitle) | :wikitext(args.pretitle) | ||
end | end | ||
else | |||
root | |||
:addClass('vertical-navbox-subgroup') | |||
:css('width', '100%') | |||
:css('margin', '0px') | |||
:css('border-spacing', '0px') | |||
:addClass(args.bodyclass or args.class) | |||
:cssText(args.bodystyle or args.style) | |||
end | end | ||
97번째 줄: | 112번째 줄: | ||
root | root | ||
:wikitext(args.title) | :wikitext(args.title) | ||
else | else | ||
root | root | ||
179번째 줄: | 193번째 줄: | ||
:tag('td') | :tag('td') | ||
:addClass(args.contentclass) | :addClass(args.contentclass) | ||
:css('padding', '0 0.1em 0.4em') | :css('padding', hasSubgroup(content) and '0.1em 0 0.2em' or '0 0.1em 0.4em') | ||
:cssText(args.contentstyle) | :cssText(args.contentstyle) | ||
:cssText(args['content' .. num .. 'style']) | :cssText(args['content' .. num .. 'style']) | ||
203번째 줄: | 217번째 줄: | ||
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$', '') ~= 'Template:Sidebar') then | ||
root | root | ||
:tag('tr') | :tag('tr') | ||
218번째 줄: | 232번째 줄: | ||
end | end | ||
return tostring(root) | return tostring(root) .. (child and '[[Category:Pages using sidebar with the child parameter]]' or '') | ||
end | end | ||
227번째 줄: | 241번째 줄: | ||
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$', '') == 'Template:Sidebar with collapsible lists' then | ||
args.navbar = 'none' | args.navbar = 'none' | ||
end | end |