Module:Infobox: Difference between revisions

    m>Plastikspork
    (Remove br between image and caption as requested on the talk page (please revert if this causes a problem!))
    m>Mr. Stradivarius
    (allow setting ids for rows, headers, labels and data fields, per protected edit request by User:Czarkoff)
    Line 47: Line 47:
                 .tag('tr')
                 .tag('tr')
                     .addClass(rowArgs.rowclass)
                     .addClass(rowArgs.rowclass)
                    .attr('id', rowArgs.rowid)
                     .tag('th')
                     .tag('th')
                         .attr('colspan', 2)
                         .attr('colspan', 2)
                        .attr('id', rowArgs.headerid)
                         .addClass(rowArgs.class)
                         .addClass(rowArgs.class)
                         .addClass(args.headerclass)
                         .addClass(args.headerclass)
    Line 57: Line 59:
             local row = root.tag('tr')
             local row = root.tag('tr')
             row.addClass(rowArgs.rowclass)
             row.addClass(rowArgs.rowclass)
            row.attr('id', rowArgs.rowid)
             if rowArgs.label then
             if rowArgs.label then
                 row
                 row
                     .tag('th')
                     .tag('th')
                         .attr('scope', 'row')
                         .attr('scope', 'row')
                        .attr('id', rowArgs.labelid)
                         .css('text-align', 'left')
                         .css('text-align', 'left')
                         .cssText(args.labelstyle)
                         .cssText(args.labelstyle)
    Line 74: Line 78:
             end
             end
             dataCell
             dataCell
                .attr('id', rowArgs.dataid)
                 .addClass(rowArgs.class)
                 .addClass(rowArgs.class)
                 .cssText(rowArgs.datastyle)
                 .cssText(rowArgs.datastyle)
    Line 176: Line 181:
                 datastyle = args.datastyle,
                 datastyle = args.datastyle,
                 class = args['class' .. tostring(num)],
                 class = args['class' .. tostring(num)],
                 rowclass = args['rowclass' .. tostring(num)]
                 rowclass = args['rowclass' .. tostring(num)],
                dataid = args['dataid' .. tostring(num)],
                labelid = args['labelid' .. tostring(num)],
                headerid = args['headerid' .. tostring(num)],
                rowid = args['rowid' .. tostring(num)]
             })
             })
         end
         end
    Line 367: Line 376:
             {prefix = 'data', depend = {'label'}},
             {prefix = 'data', depend = {'label'}},
             {prefix = 'rowclass'},
             {prefix = 'rowclass'},
             {prefix = 'class'}
             {prefix = 'class'},
            {prefix = 'dataid'},
            {prefix = 'labelid'},
            {prefix = 'headerid'},
            {prefix = 'rowid'}
         }, 50)
         }, 50)
         preprocessSingleArg('headerclass')
         preprocessSingleArg('headerclass')