private Method

LineCollection.tidy_blank_lines

Finally tidy up the blank lines:

  • change Blank/ListEnd into ListEnd/Blank
  • remove blank lines at the front

Source Code

# File rdoc/markup/simple_markup/fragments.rb, line 309
def tidy_blank_lines
  (@fragments.size - 1).times do |i|
    if @fragments[i].kind_of?(BlankLine) and 
        @fragments[i+1].kind_of?(ListEnd)
      @fragments[i], @fragments[i+1] = @fragments[i+1], @fragments[i] 
    end
  end

  # remove leading blanks
  @fragments.each_with_index do |f, i|
    break unless f.kind_of? BlankLine
    @fragments[i] = nil
  end

  @fragments.compact!
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.