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_html, #strip_html, #unescape_html
Methods inherited from TOCPrinter
default_upper_level, #initialize, #nkffilter, #print?
Constructor Details
This class inherits a constructor from ReVIEW::TOCPrinter
Instance Method Details
#print_book(book) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/review/tocprinter.rb', line 105 def print_book(book) return unless print?(1) html = "" book.each_part do |part| html << h1(part.name) if part.name part.each_section do |chap| if chap.number name = "chap#{chap.number}" label = "第#{chap.number}章 #{chap.label}" html << h2(a_name(escape_html(name), escape_html(label))) else label = "#{chap.label}" html << h2(escape_html(label)) end return unless print?(2) if print?(3) html << chap_sections_to_s(chap) else html << chapter_to_s(chap) end end end puts HTMLLayout.new(html, "目次", File.join(book.basedir, "layouts", "layout.erb")).result end |