Class: ReVIEW::HTMLTOCPrinter
- Inherits:
-
TOCPrinter
- Object
- TOCPrinter
- ReVIEW::HTMLTOCPrinter
- Includes:
- HTMLUtils
- Defined in:
- lib/review/tocprinter.rb
Constant Summary
Constants included from HTMLUtils
Instance Method Summary collapse
Methods included from HTMLUtils
#escape_comment, #escape_html, #highlight, #highlight?, #normalize_id, #strip_html, #unescape_html
Methods inherited from TOCPrinter
default_upper_level, #initialize, #print?
Constructor Details
This class inherits a constructor from ReVIEW::TOCPrinter
Instance Method Details
#print_book(book) ⇒ Object
100 101 102 103 104 105 106 |
# File 'lib/review/tocprinter.rb', line 100 def print_book(book) @out.puts '<ul class="book-toc">' book.each_part do |part| print_part(part) end @out.puts '</ul>' end |
#print_chapter(chap) ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/review/tocprinter.rb', line 115 def print_chapter(chap) chap_node = TOCParser.chapter_node(chap) ext = chap.book.config["htmlext"] || "html" path = chap.path.sub(/\.re/, "."+ext) if chap_node.number && chap.on_CHAPS? label = "#{chap.number} #{chap.title}" else label = 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 |
#print_part(part) ⇒ Object
108 109 110 111 112 113 |
# File 'lib/review/tocprinter.rb', line 108 def print_part(part) if part.number @out.puts li(part.title) end super end |