class Epubber::Generators::Chapters

Public Instance Methods

generate() click to toggle source
# File lib/epubber/generators/chapters.rb, line 5
def generate
  compiled_template = template.compile 'OEBPS/Text/chapter.xhtml'
  book.chapters.each do |chapter|
    generate_chapter compiled_template, chapter
  end
end

Protected Instance Methods

generate_chapter(compiled_template, chapter) click to toggle source
# File lib/epubber/generators/chapters.rb, line 14
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