Content deleted Content added
pare that comment back a bit |
class -> config |
||
Line 1:
local p = {}
local navbar = require('Module:Navbar')._navbar
local cfg = mw.loadData('Module:Navbox/configuration/sandbox')
local getArgs -- lazily initialized
local args
Line 70:
end
local function has_navbar()
return args[cfg.arg.navbar] ~= cfg.keyword.navbar_off
Line 262 ⟶ 261:
end
local function has_list_class(htmlclass)
}▼
local patterns = {
'^' .. htmlclass .. '$',
Line 277 ⟶ 269:
}
for
if type(arg) == 'string' and mw.ustring.find(arg, cfg.pattern.class) then
if mw.ustring.find(args[arg] or '', pattern) then
return true
end
end
end
Line 289 ⟶ 283:
-- there are a lot of list classes in the wild, so we add their TemplateStyles
local function add_list_styles()
local function add_list_templatestyles(htmlclass, templatestyles)
▲ local frame = mw.getCurrentFrame()
if has_list_class(htmlclass) then
return frame:extensionTag{
Line 300 ⟶ 294:
end
local hlist_styles = add_list_templatestyles('hlist', 'Hlist/styles.css')
local plainlist_styles = add_list_templatestyles('plainlist', 'Plainlist/styles.css')
-- a second workaround for [[phab:T303378]]
return plainlist_styles▼
-- when that issue is fixed, we can actually use has_navbar not to emit the
-- tag here if we want
if has_navbar() and hlist_styles == '' then
hlist_styles = frame:extensionTag{
name = 'templatestyles', args = { src = 'Hlist/styles.css' }
}
end
-- hlist -> plainlist is best-effort to preserve old Common.css ordering.
-- this ordering is not a guarantee because most navboxes will emit only
-- one of these classes [hlist_note]
▲ return hlist_styles .. plainlist_styles
end
Line 431 ⟶ 436:
:addClass(cfg.class.navbox_styles)
:wikitext(
-- see [hlist_note] above about ordering
add_list_styles() ..▼
base_templatestyles ..
templatestyles ..
child_templatestyles ..
▲ add_list_styles() ..
table.concat(hiding_templatestyles)
)
|