Module:CRTModel: Difference between revisions

Add embedded styles with night mode support (skin-theme-clientpref-night selector) (via update-page on MediaWiki MCP Server)
Use frame:extensionTag for style output to avoid HTML escaping (via update-page on MediaWiki MCP Server)
Line 21: Line 21:


-- Generate the CSS for night mode support
-- Generate the CSS for night mode support
local function getStyles()
local function getStylesContent()
return [[<style>
return [[
/* CRT Model Infobox - Base Styles (Light Mode) */
/* CRT Model Infobox - Base Styles (Light Mode) */
.infobox-crt-model {
.infobox-crt-model {
Line 139: Line 139:
}
}
}
}
</style>]]
]]
end
end


Line 203: Line 203:
local weight = trim(args.weight)
local weight = trim(args.weight)
local standards_semantic = trim(args.standards_semantic)
local standards_semantic = trim(args.standards_semantic)
-- Use frame:extensionTag to create a proper <style> tag that won't be escaped
local styleTag = frame:extensionTag('templatestyles', '', {src = 'Template:CRT model/styles.css'})


local container = mw.html.create('div')
local container = mw.html.create('div')
Line 517: Line 520:
displayText = docTitle
displayText = docTitle
elseif docType then
elseif docType then
displayText = docType
displayText = docTitle
end
end
Line 630: Line 633:
editDiv:wikitext('[' .. tostring(editUrl) .. ' <span class="infobox-button infobox-button-primary">Edit this data</span>]')
editDiv:wikitext('[' .. tostring(editUrl) .. ' <span class="infobox-button infobox-button-primary">Edit this data</span>]')


-- Return styles + container HTML
-- Return templatestyles tag + container HTML
return getStyles() .. tostring(container)
return styleTag .. tostring(container)
end
end


return p
return p
MediaWiki Appliance - Powered by TurnKey Linux