Return a block consisting of fragments which are paragraphs, list entries or verbatim text. We merge consecutive lines of the same type and level together. We are also slightly tricky with lists: the lines following a list introduction look like paragraph lines at the next level, and we remap them into list entries instead.
# File lib/rdoc/markup.rb, line 328 def group_lines @lines.rewind in_list = false wanted_type = wanted_level = nil block = LineCollection.new group = nil while line = @lines.next if line.level == wanted_level and line.type == wanted_type group.add_text(line.text) else group = block.fragment_for(line) block.add(group) if line.type == :LIST wanted_type = :PARAGRAPH else wanted_type = line.type end wanted_level = line.type == :HEADING ? line.param : line.level end end block.normalize block end