Editing Module:Side box
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 71: | Line 71: | ||
-- Table root | -- Table root | ||
local root = mw.html.create('table') | local root = mw.html.create('table') | ||
for i, class in ipairs(data.classes or {}) do | for i, class in ipairs(data.classes or {}) do | ||
root:addClass(class) | root:addClass(class) | ||
end | end | ||
root:css{border = '1px solid #aaa', ['background-color'] = '#f9f9f9 | root:css{border = '1px solid #aaa', ['background-color'] = '#f9f9f9'} | ||
if data.style then | if data.style then | ||
root:cssText(data.style) | root:cssText(data.style) | ||
Line 82: | Line 81: | ||
-- The "above" row | -- The "above" row | ||
if data.above then | if data.above then | ||
local aboveCell = root | local aboveCell = root:tag('tr'):tag('td') | ||
aboveCell | aboveCell | ||
:attr('colspan', data.imageright and 3 or 2) | :attr('colspan', data.imageright and 3 or 2) | ||
Line 98: | Line 97: | ||
-- The body row | -- The body row | ||
local bodyRow = root:newline():tag('tr' | local bodyRow = root:newline():tag('tr') | ||
if data.image then | if data.image then | ||
bodyRow:tag('td') | bodyRow:tag('td') | ||
Line 106: | Line 105: | ||
bodyRow:tag('td'):css('width', '1px') | bodyRow:tag('td'):css('width', '1px') | ||
end | end | ||
local textCell = bodyRow | local textCell = bodyRow:tag('td') | ||
textCell:addClass('mbox-text plainlist') | textCell:addClass('mbox-text plainlist') | ||
if data.textstyle then | if data.textstyle then | ||
Line 113: | Line 112: | ||
textCell:wikitext(data.text) | textCell:wikitext(data.text) | ||
if data.imageright then | if data.imageright then | ||
bodyRow | bodyRow:tag('td') | ||
:addClass('mbox-imageright') | :addClass('mbox-imageright') | ||
:wikitext(data.imageright) | :wikitext(data.imageright) | ||
Line 130: | Line 129: | ||
end | end | ||
return tostring(root) | return tostring(root) | ||
end | end | ||
return p | return p |