Class: ReVIEW::HTMLTOCPrinter

Inherits:
TOCPrinter show all
Includes:
HTMLUtils
Defined in:
lib/review/tocprinter.rb

Constant Summary

Constants included from HTMLUtils

ReVIEW::HTMLUtils::ESC

Instance Method Summary collapse

Methods included from HTMLUtils

#escape, #escape_comment, #highlight, #highlight?, #highlight_pygments, #highlight_rouge, #normalize_id, #strip_html, #unescape

Methods inherited from TOCPrinter

default_upper_level, #initialize, #print?

Constructor Details

This class inherits a constructor from ReVIEW::TOCPrinter

Instance Method Details



85
86
87
88
89
# File 'lib/review/tocprinter.rb', line 85

def print_book(book)
  @out.puts '<ul class="book-toc">'
  book.each_part { |part| print_part(part) }
  @out.puts '</ul>'
end


98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/review/tocprinter.rb', line 98

def print_chapter(chap)
  chap_node = TOCParser.chapter_node(chap)
  ext = chap.book.config['htmlext'] || 'html'
  path = chap.path.sub(/\.re/, '.' + ext)
  label = if chap_node.number && chap.on_chaps?
            "#{chap.number} #{chap.title}"
          else
            chap.title
          end
  @out.puts li(a_name(path, escape_html(label)))
  return unless print?(2)
  if print?(3)
    @out.puts chap_sections_to_s(chap_node)
  else
    @out.puts chapter_to_s(chap_node)
  end
end


91
92
93
94
95
96
# File 'lib/review/tocprinter.rb', line 91

def print_part(part)
  if part.number
    @out.puts li(part.title)
  end
  super
end