Модуль: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 html = mw.html.create('div')
     local wrapper = mw.html.create('div')
        :addClass('decarabia thumb tright')
         :css({
         :css({
             ['background-color'] = 'transparent',
            float = 'right',
             ['border-color'] = 'transparent'
            clear = 'right',
            margin = '0 0 1em 1em',
            ['max-width'] = '320px',
             ['font-size'] = '88%',
             ['line-height'] = '1.5em'
         })
         })


     local tableEl = html:tag('table')
     local tableEl = wrapper:tag('table')
         :css({
         :css({
             width = '320px',
             width = '100%',
             border = '1px solid #c8ccd1',
             border = '1px solid #a2a9b1',
             padding = '5px',
             ['border-collapse'] = 'collapse',
             ['font-size'] = '10pt'
            background = '#f8f9fa',
             ['font-size'] = '100%'
         })
         })


Строка 25: Строка 29:
             :attr('colspan', '2')
             :attr('colspan', '2')
             :css({
             :css({
                 ['font-size'] = '16pt',
                background = '#cee0f2',
                 ['font-family'] = 'Times New Roman',
                 ['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({
                 ['padding-top'] = '1.2em',
                 ['text-align'] = 'center',
                 ['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('th')
             :tag('td')
             :attr('colspan', '2')
             :attr('colspan', '2')
             :css({
             :css({
                 ['font-size'] = '8pt',
                 ['text-align'] = 'center',
                 ['font-family'] = 'Arial',
                 ['font-size'] = '0.9em',
                 ['text-align'] = 'center'
                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('td')
                 row:tag('th')
                     :addClass('decarabia-param')
                     :css({
                    :css('text-align', 'right')
                        ['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')
                     :addClass('decarabia-text')
                     :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', 'center')
                     :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(html)
     return tostring(wrapper)
end
end


return p
return p