Module:Side box: Difference between revisions
Jump to navigation
Jump to search
m
tweak color per request
(صفحهای تازه حاوی «-- This module implements {{side box}}. local yesno = require('Module:Yesno') local p = {} function p.main(frame) local origArgs = fram...» ایجاد کرد) |
m (tweak color per request) |
||
Line 30: | Line 30: | ||
table.insert(data.classes, 'metadata') | table.insert(data.classes, 'metadata') | ||
end | end | ||
if args.position and | if args.position and args.position:lower() == 'left' then | ||
table.insert(data.classes, 'mbox-small- | table.insert(data.classes, 'mbox-small-left') | ||
else | else | ||
table.insert(data.classes, 'mbox-small') | table.insert(data.classes, 'mbox-small') | ||
Line 54: | Line 54: | ||
-- Body row | -- Body row | ||
'text', | 'text', | ||
' | 'imageright', | ||
-- Below row | -- Below row | ||
Line 71: | Line 71: | ||
-- Table root | -- Table root | ||
local root = mw.html.create('table') | local root = mw.html.create('table') | ||
root:attr('role', 'presentation') | |||
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', color = '#000'} | ||
if data.style then | if data.style then | ||
root:cssText(data.style) | root:cssText(data.style) | ||
Line 83: | Line 84: | ||
local aboveCell = root:newline():tag('tr'):tag('td') | local aboveCell = root:newline():tag('tr'):tag('td') | ||
aboveCell | aboveCell | ||
:attr('colspan', data. | :attr('colspan', data.imageright and 3 or 2) | ||
:addClass('mbox-text') | :addClass('mbox-text') | ||
if data.textstyle then | if data.textstyle then | ||
Line 111: | Line 112: | ||
end | end | ||
textCell:wikitext(data.text) | textCell:wikitext(data.text) | ||
if data. | if data.imageright then | ||
bodyRow:newline():tag('td') | bodyRow:newline():tag('td') | ||
:addClass('mbox- | :addClass('mbox-imageright') | ||
:wikitext(data. | :wikitext(data.imageright) | ||
end | end | ||
Line 121: | Line 122: | ||
local belowCell = root:newline():tag('tr'):tag('td') | local belowCell = root:newline():tag('tr'):tag('td') | ||
belowCell | belowCell | ||
:attr('colspan', data. | :attr('colspan', data.imageright and 3 or 2) | ||
:addClass('mbox-text') | :addClass('mbox-text') | ||
if data.textstyle then | if data.textstyle then |