Module:Sidebar: Difference between revisions
breaking more wikis |
add list-title-centered |
||
Line 286: | Line 286: | ||
categorizeTemplatesWithInlineStyles(args) | categorizeTemplatesWithInlineStyles(args) | ||
}) | }) | ||
end | |||
local function collapsible_title(args, is_centered_collapsible_titles, num) | |||
local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title'] | |||
or cfg.i18n.default_list_title) | |||
local title | |||
if is_centered_collapsible_titles then | |||
-- collapsible can be finicky, so provide some CSS/HTML to support | |||
title = mw.html.create('div') | |||
:addClass(cfg.i18n.class.list_title_centered) | |||
:wikitext(title_text) | |||
else | |||
title = mw.html.create() | |||
:wikitext(title_text) | |||
end | |||
local title_container = mw.html.create('div') | |||
:addClass(cfg.i18n.class.list_title) | |||
-- don't /need/ a listnumtitleclass because you can do | |||
-- .templateclass .listnumclass .sidebar-list-title | |||
:addClass(args.listtitleclass) | |||
:cssText(args.basestyle) | |||
:cssText(args.listtitlestyle) | |||
:cssText(args['list' .. num .. 'titlestyle']) | |||
:node(title) | |||
:done() | |||
return title_container | |||
end | end | ||
Line 302: | Line 332: | ||
local contentArgs = {} | local contentArgs = {} | ||
local is_centered_collapsible_titles | |||
if args['centered collapsible titles'] and args['centered collapsible titles'] ~= '' then | |||
is_centered_collapsible_titles = true | |||
else | |||
is_centered_collapsible_titles = false | |||
end | |||
for k, v in pairs(args) do | for k, v in pairs(args) do | ||
Line 316: | Line 353: | ||
:cssText(args.listframestyle) | :cssText(args.listframestyle) | ||
:cssText(args['list' .. num .. 'framestyle']) | :cssText(args['list' .. num .. 'framestyle']) | ||
: | :node(collapsible_title(args, is_centered_collapsible_titles, num)) | ||
:tag('div') | :tag('div') | ||
:addClass(cfg.i18n.class.list_content) | :addClass(cfg.i18n.class.list_content) |