Module:Aligned table: Difference between revisions

    No edit summary
    No edit summary
    Line 12: Line 12:
    local colstyle = {}
    local colstyle = {}
    local cols = tonumber(args['cols']) or 2
    local cols = tonumber(args['cols']) or 2
    local noblankrows = args['noblankrows'] or ''


    -- create the root table
    -- create the root table
    Line 114: Line 113:
    row:css('vertical-align', 'top')
    row:css('vertical-align', 'top')
    end
    end
    -- skip blank rows, if feature is enabled
    -- loop over the cells in each row
    local showrow = 1
    if isnotempty(noblankrows) then
    showrow = 0
    for i=1,cols do
    if isnotempty(args[cols*(j - 1) + i] or '') then
    showrow = 1
    break
    end
    end
    end
    -- loop over the cells in the row
    if showrow then
    for i=1,cols do
    for i=1,cols do
    local cell
    local cell
    Line 160: Line 147:
    end
    end
    end
    end
    cell:wikitext(mw.ustring.gsub(args[cols*(j - 1) + i] or '','^(.-)%s*$', '%1'))
    cell:wikitext(mw.ustring.gsub(args[cols*(j - 1) + i] or '','%s*$', ''))
    end
    end
    end
    end
    end