Module:InfoboxTitle
From Inkipedia, the Splatoon wiki
Produces a title header for an infobox.
Parameters
text |
Unnamed. | The infobox's title text. |
color |
Optional. | An RGB triplet to use as the base color for formatting. The default color is 0, 153, 255, defined in SiteColor as "Generic". |
style |
Optional. | A CSS property list to apply to the container. |
Example
Markup
{{InfoboxTitle|color={{SiteColor|Splatoon}}|Title Text}}
Output
Title Text
local p = {} local siteColor = require('Module:SiteColor') -- Import the SiteColor module function p.main(frame) local args = frame:getParent().args -- content is first unnamed argument local content = args[1] or '' -- color argument or default to Generic local color = args['color'] or siteColor.getSiteColor("Generic") -- Get any additional styles local style = args['style'] or '' return p.getTitle(content, color, style) end -- Function to render the div with styles function p.getTitle(content, color, style) -- Start the HTML div string local result = '<div style="' -- Add the styles result = result .. 'padding: 10px; ' result = result .. 'background: rgba(' .. color .. ', 0.3); ' result = result .. 'border-width: 1px 5px 1px 5px; ' result = result .. 'border-style: solid; ' result = result .. 'border-color: rgba(' .. color .. ', 0.5); ' result = result .. 'border-radius: 5px 5px 5px 5px; ' result = result .. 'text-align: center; ' result = result .. 'font-size: 20px; ' -- Add any additional styles if style ~= '' then result = result .. style end -- Close the style attribute and add the content result = result .. '">' .. "'''" .. content .. "'''" .. '</div>' return result end return p