Module:Sidebar: Difference between revisions
Richardpruen (talk | contribs) m 1 revision imported: Templates and CSS files |
imported>Izno move these items to config, discovered during work at meta |
||
Line 53: | Line 53: | ||
end | end | ||
local function has_navbar(navbar_mode, sidebar_name) | local function has_navbar(navbar_mode, sidebar_name) | ||
return navbar_mode ~= cfg.i18n.navbar_none and | return navbar_mode ~= cfg.i18n.navbar_none and | ||
Line 87: | Line 85: | ||
-- there are a lot of list classes in the wild, so we add their TemplateStyles | -- there are a lot of list classes in the wild, so we add their TemplateStyles | ||
local function add_list_styles(args) | local function add_list_styles(args) | ||
local frame = mw.getCurrentFrame() | |||
local function add_list_templatestyles(htmlclass, templatestyles) | local function add_list_templatestyles(htmlclass, templatestyles) | ||
if has_list_class(args, htmlclass) then | if has_list_class(args, htmlclass) then | ||
return frame:extensionTag{ | return frame:extensionTag{ | ||
Line 97: | Line 95: | ||
end | end | ||
end | end | ||
-- | local plainlist_styles = add_list_templatestyles('plainlist', cfg.i18n.plainlist_templatestyles) | ||
local hlist_styles = add_list_templatestyles('hlist', cfg.i18n.hlist_templatestyles) | |||
-- a second workaround for [[phab:T303378]] | |||
-- when that issue is fixed, we can actually use has_navbar not to emit the | |||
-- tag here if we want | |||
if has_navbar(args.navbar, args.name) and hlist_styles == '' then | |||
hlist_styles = frame:extensionTag{ | |||
name = 'templatestyles', args = { src = cfg.i18n.hlist_templatestyles} | |||
} | |||
end | |||
return plainlist_styles | -- hlist -> plainlist is best-effort to preserve old Common.css ordering. [hlist_note] | ||
return hlist_styles .. plainlist_styles | |||
end | end | ||
Line 340: | Line 348: | ||
return table.concat({ | return table.concat({ | ||
add_list_styles(args), -- see [hlist_note] above about ordering | |||
base_templatestyles, | base_templatestyles, | ||
templatestyles, | templatestyles, | ||
child_templatestyles, | child_templatestyles, | ||
grandchild_templatestyles, | grandchild_templatestyles, | ||
hiding_templatestyles, | hiding_templatestyles, | ||
tostring(root), | tostring(root), |