Anonymous user
Module:Navbox: Difference between revisions
per Template talk:Navbox#Night mode may need explicit color definitions
(username removed) m (1 revision imported) |
WordPress>Izno |
||
Line 79: | Line 79: | ||
~= cfg.pattern.navbox | ~= cfg.pattern.navbox | ||
) | ) | ||
end | |||
-- extract text color from css, which is the only permitted inline CSS for the navbar | |||
local function extract_color(css_str) | |||
-- return nil because navbar takes its argument into mw.html which handles | |||
-- nil gracefully, removing the associated style attribute | |||
return mw.ustring.match(';' .. css_str .. ';', '.*;%s*([Cc][Oo][Ll][Oo][Rr]%s*:%s*.-)%s*;') or nil | |||
end | end | ||
Line 86: | Line 93: | ||
[cfg.navbar.name] = args[cfg.arg.name], | [cfg.navbar.name] = args[cfg.arg.name], | ||
[cfg.navbar.mini] = 1, | [cfg.navbar.mini] = 1, | ||
[cfg.navbar.fontstyle] = (args[cfg.arg.basestyle] or '') .. ';' .. | [cfg.navbar.fontstyle] = extract_color( | ||
(args[cfg.arg.basestyle] or '') .. ';' .. (args[cfg.arg.titlestyle] or '') | |||
) | |||
}) | }) | ||
end | end |