lib/review/tocprinter.rb in review-3.2.0 vs lib/review/tocprinter.rb in review-4.0.0

- old
+ new

@@ -30,12 +30,12 @@ part.each_chapter { |chap| print_chapter(chap) } end def print_chapter(chap) chap_node = TOCParser.chapter_node(chap) - print_node 1, chap_node - print_children chap_node + print_node(1, chap_node) + print_children(chap_node) end def print?(level) level <= @print_upper end @@ -46,26 +46,26 @@ def print_children(node) return unless print?(node.level + 1) node.each_section_with_index do |section, idx| unless section.blank? - print_node idx + 1, section - print_children section + print_node(idx + 1, section) + print_children(section) end end end def print_node(number, node) if node.chapter? vol = node.volume - @out.printf "%3s %3dKB %6dC %5dL %s (%s)\n", + @out.printf("%3s %3dKB %6dC %5dL %s (%s)\n", chapnumstr(node.number), vol.kbytes, vol.chars, vol.lines, - node.label, node.chapter_id + node.label, node.chapter_id) else ## for section node - @out.printf "%17s %5dL %s\n", + @out.printf("%17s %5dL %s\n", '', node.estimated_lines, - " #{' ' * (node.level - 1)}#{number} #{node.label}" + " #{' ' * (node.level - 1)}#{number} #{node.label}") end end def chapnumstr(n) n ? sprintf('%2d.', n) : ' '