Changes
we cookin with plainlist templatestyles now
local yesno = require('Module:Yesno')
local p = {}
local data = {}
end
if args.position and args.position:lower() == 'left' then
table.insert(data.classes, 'mboxside-smallbox-left')
else
table.insert(data.classes, 'mboxside-smallbox-right') end if args.collapsible then table.insert(data.classes, 'mw-collapsible') if args.collapsible == "collapsed" then table.insert(data.classes, 'mw-collapsed') end data.collapsible = true
end
table.insert(data.classes, args.class)
if args.image and args.image ~= 'none' then
data.image = args.image
end
-- we have to check to see if a downstream use has plainlist like
-- Template:Sister_project. also it's the default. wikitext is :(
if args.textclass == 'plainlist' or not args.textclass then
data.textclass = 'plainlist'
data.plainlist_templatestyles = 'Plainlist/styles.css'
else
data.textclass = args.textclass
end
-- Copy over data that doesn't does not need adjusting
local argsToCopy = {
-- aria qualities
'role',
'labelledby',
-- Styles
'style',
'textstyle',
'templatestyles',
-- Above row
end
local function p.renderSidebox(data)
-- Renders the sidebox HTML.
-- Table root
local root = mw.html.create('tablediv') root:attr('role', data.role) :attr('aria-labelledby', data.labelledby) :addClass('presentationside-box')
for i, class in ipairs(data.classes or {}) do
root:addClass(class)
end
if data.style then
root:cssText(data.style)
end
local frame = mw.getCurrentFrame()
if data.plainlist_templatestyles then
root:wikitext(frame:extensionTag{
name = 'templatestyles', args = { src = data.plainlist_templatestyles }
})
end
-- The "above" row
if data.above then
local aboveCell above = root:newline():tag('trdiv') above:tagaddClass('tdside-box-abovebelow') aboveCell :attrnewline('colspan', data.imageright and 3 or 2) :addClasswikitext('mbox-text'data.above)
if data.textstyle then
end
if data.abovestyle then
end
end
-- The body row
local bodyRow body = root:newline():tag('trdiv') body:addClass('side-box-flex') :addClass(data.collapsible and 'mw-collapsible-content') :newline()
if data.image then
:wikitext(data.image)
end
local textCell text = bodyRowbody:newline():tag('tddiv') textCelltext:addClass('mboxside-box-text plainlist') :addClass(data.textclass)
if data.textstyle then
end
if data.imageright then
:wikitext(data.imageright)
end
-- The below row
if data.below then
local belowCell below = root:newline():tag('tr'):tag('tddiv') belowCellbelow :attraddClass('colspanside-box-abovebelow', data.imageright and 3 or 2) :addClasswikitext('mbox-text'data.below)
if data.textstyle then
end
end
root:newline()
local templatestyles = '' if data.templatestyles then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = data.templatestyles } } end return frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Side box/styles.css' } } .. templatestyles .. tostring(root)end function p._main(args) local data = makeData(args) return renderSidebox(data)end function p.main(frame) local origArgs = frame:getParent().args local args = {} for k, v in pairs(origArgs) do v = v:match('%s*(.-)%s*$') if v ~= '' then args[k] = v end end return p._main(args)
end
return p