Content deleted Content added
redundant |
nothing could go possibly wrong with this design |
||
Line 5:
local p = {}
local function
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▼
function p._main(args)▼
local data = p.makeData(args)▼
return p.renderSidebox(data)▼
end▼
function p.makeData(args)▼
local data = {}
Line 31 ⟶ 14:
end
if args.position and args.position:lower() == 'left' then
table.insert(data.classes, '
else
table.insert(data.classes, '
end
table.insert(data.classes, args.class)
Line 69 ⟶ 52:
end
local function
-- Renders the sidebox HTML.
-- Table root
local root = mw.html.create('
root:attr('role', 'presentation')
:addClass('side-box')
for i, class in ipairs(data.classes or {}) do
root:addClass(class)
end
if data.style then
root:cssText(data.style)
Line 85 ⟶ 68:
-- The "above" row
if data.above then
local
above:addClass('side-box-abovebelow')
:newline()▼
:
if data.textstyle then
end
if data.abovestyle then
end
▲ :newline()
end
-- The body row
local
if data.image then
:addClass('
:wikitext(data.image)
end
local
if data.textstyle then
end
if data.imageright then
:addClass('
:wikitext(data.imageright)
end
Line 124 ⟶ 102:
-- The below row
if data.below then
local
below
:addClass('side-box-abovebelow')
:
if data.textstyle then
end
end
root:newline()
return
'templatestyles', args = { src = 'Module:Side box/styles.css' }
} .. tostring(root)
▲end
▲function p._main(args)
▲end
▲ 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
|