private Method

LineCollection.add_list_start_and_ends

List nesting is implicit given the level of Make it explicit, just to make life a tad easier for the output processors

Source Code

# File rdoc/markup/simple_markup/fragments.rb, line 239
def add_list_start_and_ends
  level = 0
  res = []
  type_stack = []

  @fragments.each do |fragment|
    # $stderr.puts "#{level} : #{fragment.class.name} : #{fragment.level}"
    new_level = fragment.level
    while (level < new_level)
      level += 1
      type = fragment.type
      res << ListStart.new(level, fragment.param, type) if type
      type_stack.push type
      # $stderr.puts "Start: #{level}"
    end

    while level > new_level
      type = type_stack.pop
      res << ListEnd.new(level, type) if type
      level -= 1
      # $stderr.puts "End: #{level}, #{type}"
    end

    res << fragment
    level = fragment.level
  end
  level.downto(1) do |i|
    type = type_stack.pop
    res << ListEnd.new(i, type) if type
  end

  @fragments = res
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.