Module:Sidebar: Difference between revisions
Appearance
add some tracking with Category:Pages using sidebar with the child parameter |
update from sandbox per discussion on talk page |
||
Line 19: | Line 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 | ||
Line 29: | Line 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) | ||
Line 90: | Line 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 | ||
Line 97: | Line 112: | ||
root | root | ||
:wikitext(args.title) | :wikitext(args.title) | ||
else | else | ||
root | root | ||
Line 179: | Line 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']) |