Module:NavboxUpgraded: Difference between revisions
EnWikiAdmin (talk | contribs) No edit summary |
EnWikiAdmin (talk | contribs) No edit summary |
||
Line 246: | Line 246: | ||
local function add_navbox_styles() | local function add_navbox_styles() | ||
local | local html = mw.html.create() | ||
-- Helper function to add a stylesheet link | |||
local function add_stylesheet(path) | |||
html:tag('link') | |||
:attr('rel', 'stylesheet') | |||
:attr('href', path) | |||
:attr('type', 'text/css') | |||
end | end | ||
if type(cfg. | |||
-- Assuming cfg.templatestyles contains space-separated CSS file paths | |||
if type(cfg.templatestyles) == 'string' and cfg.templatestyles ~= '' then | |||
for stylePath in cfg.templatestyles:gmatch("[^%s]+") do | |||
add_stylesheet(stylePath) | |||
end | |||
end | end | ||
if type(cfg. | |||
if type(cfg.hlist_templatestyles) == 'string' and cfg.hlist_templatestyles ~= '' then | |||
for stylePath in cfg.hlist_templatestyles:gmatch("[^%s]+") do | |||
add_stylesheet(stylePath) | |||
end | |||
end | end | ||
if type(cfg.plainlist_templatestyles) == 'string' and cfg.plainlist_templatestyles ~= '' then | |||
for stylePath in cfg.plainlist_templatestyles:gmatch("[^%s]+") do | |||
add_stylesheet(stylePath) | |||
end | |||
end | |||
return html:done() | |||
end | end | ||