# File lib/asciidoctor/table.rb, line 514
  def close_cell(eol = false)
    if @format == 'psv'
      strip_text = true
      cell_text = @buffer
      @buffer = ''
      if (cellspec = take_cellspec)
        repeat = cellspec.delete('repeatcol') || 1
      else
        warn %(asciidoctor: ERROR: #{@last_cursor.line_info}: table missing leading separator, recovering automatically)
        cellspec = {}
        repeat = 1
      end
    else
      strip_text = false
      cell_text = @buffer.strip
      @buffer = ''
      cellspec = nil
      repeat = 1
      if @format == 'csv'
        if !cell_text.empty? && cell_text.include?('"')
          # this may not be perfect logic, but it hits the 99%
          if cell_text.start_with?('"') && cell_text.end_with?('"')
            # unquote
            cell_text = cell_text[1...-1].strip
          end

          # collapse escaped quotes
          cell_text = cell_text.squeeze('"')
        end
      end
    end

    1.upto(repeat) do |i|
      # TODO make column resolving an operation
      if @colcount == -1
        @table.columns << (column = Table::Column.new(@table, @table.columns.size + i - 1))
        if cellspec && (cellspec.key? 'colspan') && (extra_cols = cellspec['colspan'].to_i - 1) > 0
          offset = @table.columns.size
          extra_cols.times do |j|
            @table.columns << Table::Column.new(@table, offset + j)
          end
        end
      else
        # QUESTION is this right for cells that span columns?
        unless (column = @table.columns[@current_row.size])
          warn %(asciidoctor: ERROR: #{@last_cursor.line_info}: dropping cell because it exceeds specified number of columns)
          return
        end
      end

      cell = Table::Cell.new(column, cell_text, cellspec, :cursor => @last_cursor, :strip_text => strip_text)
      @last_cursor = @reader.cursor
      unless !cell.rowspan || cell.rowspan == 1
        activate_rowspan(cell.rowspan, (cell.colspan || 1))
      end
      @column_visits += (cell.colspan || 1)
      @current_row << cell
      # don't close the row if we're on the first line and the column count has not been set explicitly
      # TODO perhaps the colcount/linenum logic should be in end_of_row? (or a should_end_row? method)
      close_row if end_of_row? && (@colcount != -1 || @linenum > 0 || (eol && i == repeat))
    end
    @cell_open = false
    nil
  end