Модуль:Infobox: различия между версиями
Новая страница: «local p = {} function p.main(frame) local args = frame:getParent().args local html = mw.html.create('div') :addClass('decarabia thumb tright') :css({ ['background-color'] = 'transparent', ['border-color'] = 'transparent' }) local tableEl = html:tag('table') :css({ width = '320px', border = '1px solid #c8ccd1', padding = '5px', ['font-size']...» |
Нет описания правки |
||
| Строка 3: | Строка 3: | ||
function p.main(frame) | function p.main(frame) | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
local | local wrapper = mw.html.create('div') | ||
:css({ | :css({ | ||
[' | float = 'right', | ||
[' | clear = 'right', | ||
margin = '0 0 1em 1em', | |||
['max-width'] = '320px', | |||
['font-size'] = '88%', | |||
['line-height'] = '1.5em' | |||
}) | }) | ||
local tableEl = | local tableEl = wrapper:tag('table') | ||
:css({ | :css({ | ||
width = ' | width = '100%', | ||
border = '1px solid # | border = '1px solid #a2a9b1', | ||
['border-collapse'] = 'collapse', | |||
['font-size'] = ' | background = '#f8f9fa', | ||
['font-size'] = '100%' | |||
}) | }) | ||
| Строка 25: | Строка 29: | ||
:attr('colspan', '2') | :attr('colspan', '2') | ||
:css({ | :css({ | ||
[' | background = '#cee0f2', | ||
['font- | ['border-bottom'] = '1px solid #a2a9b1', | ||
['text-align'] = 'center' | ['font-size'] = '1.1em', | ||
['text-align'] = 'center', | |||
padding = '5px' | |||
}) | }) | ||
:wikitext(args["имя"]) | :wikitext(args["имя"]) | ||
| Строка 38: | Строка 44: | ||
:attr('colspan', '2') | :attr('colspan', '2') | ||
:css({ | :css({ | ||
[' | ['text-align'] = 'center', | ||
[' | padding = '5px', | ||
['border-bottom'] = '1px solid #a2a9b1' | |||
}) | }) | ||
:wikitext('[[Файл:' .. args["файл"] .. '|250x250px|center]]') | :wikitext('[[Файл:' .. args["файл"] .. '|250x250px|center]]') | ||
| Строка 47: | Строка 54: | ||
if args["описание"] and args["описание"] ~= "" then | if args["описание"] and args["описание"] ~= "" then | ||
tableEl:tag('tr') | tableEl:tag('tr') | ||
:tag(' | :tag('td') | ||
:attr('colspan', '2') | :attr('colspan', '2') | ||
:css({ | :css({ | ||
[' | ['text-align'] = 'center', | ||
['font- | ['font-size'] = '0.9em', | ||
[' | color = '#555', | ||
padding = '3px 5px', | |||
['border-bottom'] = '1px solid #a2a9b1' | |||
}) | }) | ||
:wikitext(args["описание"]) | :wikitext(args["описание"]) | ||
| Строка 61: | Строка 70: | ||
local key = args[tostring(i)] | local key = args[tostring(i)] | ||
local val = args[tostring(i + 1)] | local val = args[tostring(i + 1)] | ||
if key and key ~= "" then | if key and key ~= "" then | ||
local row = tableEl:tag('tr') | local row = tableEl:tag('tr') | ||
if val and val ~= "" then | if val and val ~= "" then | ||
row:tag(' | row:tag('th') | ||
: | :css({ | ||
['text-align'] = 'right', | |||
['font-weight'] = 'bold', | |||
['vertical-align'] = 'top', | |||
padding = '3px 5px', | |||
['border-top'] = '1px solid #eaecf0', | |||
width = '45%', | |||
background = '#f8f9fa' | |||
}) | |||
:wikitext(key) | :wikitext(key) | ||
row:tag('td') | row:tag('td') | ||
: | :css({ | ||
['text-align'] = 'left', | |||
['vertical-align'] = 'top', | |||
padding = '3px 5px', | |||
['border-top'] = '1px solid #eaecf0' | |||
}) | |||
:wikitext(val) | :wikitext(val) | ||
else | else | ||
row:tag('td') | row:tag('td') | ||
:attr('colspan', '2') | :attr('colspan', '2') | ||
:css('text-align', ' | :css({ | ||
['text-align'] = 'center', | |||
['font-weight'] = 'bold', | |||
padding = '4px 5px', | |||
['border-top'] = '1px solid #a2a9b1', | |||
background = '#dce5f4' | |||
}) | |||
:wikitext(key) | :wikitext(key) | ||
end | end | ||
| Строка 83: | Строка 107: | ||
end | end | ||
return tostring( | return tostring(wrapper) | ||
end | end | ||
return p | return p | ||