Sha256: 2f74237ebd37b0ed25bcc6d6e855927610e12401c2bf4de8bf7af43122d72a99

Contents?: true

Size: 545 Bytes

Versions: 11

Compression:

Stored size: 545 Bytes

Contents

require 'epubber/generators/generator'

module Epubber::Generators
  class Chapters < Generator
    def generate
      compiled_template = template.compile 'OEBPS/Text/chapter.xhtml'
      book.chapters.each do |chapter|
        generate_chapter compiled_template, chapter
      end
    end

  protected
    
    def generate_chapter(compiled_template, chapter)
      context = chapter.contextify
      content = compiled_template.render context
      persist file: "OEBPS/Text/chapter#{context['id']}.xhtml", content: content
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
epubber-0.2.0 lib/epubber/generators/chapters.rb
epubber-0.1.5 lib/epubber/generators/chapters.rb
epubber-0.1.4 lib/epubber/generators/chapters.rb
epubber-0.1.3 lib/epubber/generators/chapters.rb
epubber-0.1.2 lib/epubber/generators/chapters.rb
epubber-0.1.1 lib/epubber/generators/chapters.rb
epubber-0.1.0 lib/epubber/generators/chapters.rb
epubber-0.0.4 lib/epubber/generators/chapters.rb
epubber-0.0.3 lib/epubber/generators/chapters.rb
epubber-0.0.2 lib/epubber/generators/chapters.rb
epubber-0.0.1 lib/epubber/generators/chapters.rb