class Rouge::Formatters::HTMLTable

def stream(tokens, &b)

def stream(tokens, &b)
  num_lines = 0
  last_val = ''
  formatted = ''
  tokens.each do |tok, val|
    last_val = val
    num_lines += val.scan(/\n/).size
    formatted << @inner.span(tok, val)
  end
  # add an extra line for non-newline-terminated strings
  if last_val[-1] != "\n"
    num_lines += 1
    @inner.span(Token::Tokens::Text::Whitespace, "\n") { |str| formatted << str }
  end
  # generate a string of newline-separated line numbers for the gutter>
  formatted_line_numbers = (@start_line..num_lines+@start_line-1).map do |i|
    sprintf("#{@line_format}", i) << "\n"
  end.join('')
  numbers = %(<pre class="lineno">#{formatted_line_numbers}</pre>)
  yield %(<table class="#@table_class"><tbody><tr>)
  # the "gl" class applies the style for Generic.Lineno
  yield %(<td class="#@gutter_class gl">)
  yield numbers
  yield '</td>'
  yield %(<td class="#@code_class"><pre>)
  yield formatted
  yield '</pre></td>'
  yield "</tr></tbody></table>\n"
end