lib/softcover/builders/epub.rb in softcover-0.9.5 vs lib/softcover/builders/epub.rb in softcover-0.9.6

- old
+ new

@@ -5,12 +5,12 @@ def build!(options={}) @preview = options[:preview] Softcover::Builders::Html.new.build! if manifest.markdown? - self.manifest = Softcover::BookManifest.new(source: :polytex, - origin: :markdown) + opts = options.merge({ source: :polytex, origin: :markdown }) + self.manifest = Softcover::BookManifest.new(opts) end remove_html create_directories write_mimetype write_container_xml @@ -59,13 +59,13 @@ # This is required by the EPUB standard. def write_contents File.write(path('epub/OEBPS/content.opf'), content_opf) end - # Returns the chapters to write (accounting for previews). + # Returns the chapters to write. def chapters - preview? ? manifest.preview_chapters : manifest.chapters + manifest.chapters end # Writes the HTML for the EPUB. # Included is a math detector that processes the page with MathJax # (via page.js) so that math can be included in EPUB (and thence MOBI). @@ -365,12 +365,10 @@ # Returns the Table of Contents for the spine. def toc_ncx title = manifest.title chapter_nav = [] - offset = preview? ? manifest.preview_chapter_range.first : 0 - chapters.each_with_index do |chapter, i| - n = i + offset + chapters.each_with_index do |chapter, n| chapter_nav << %(<navPoint id="#{chapter.slug}" playOrder="#{n+1}">) chapter_nav << %( <navLabel><text>#{chapter_name(n)}</text></navLabel>) chapter_nav << %( <content src="#{chapter.fragment_name}"/>) chapter_nav << %(</navPoint>) end \ No newline at end of file