lib/rpub/epub/html_toc.rb in rpub-0.4.0 vs lib/rpub/epub/html_toc.rb in rpub-0.5.0

- old
+ new

@@ -1,22 +1,17 @@ module Rpub class Epub class HtmlToc < XmlFile - attr_reader :book - - def initialize(book) - @book = book - super() - end - def render xml.div :id => 'toc' do xml.h1 'Table of Contents' xml.div :class => 'toc' do book.outline.each do |(filename, headings)| headings.each do |heading| - xml.div :class => "level-#{heading.level}" do - xml.a heading.text, :href => [filename, heading.html_id].join('#') + if heading.level <= (book.config.max_level || 2) + xml.div :class => "level-#{heading.level}" do + xml.a heading.text, :href => [filename, heading.html_id].join('#') + end end end end end end