examples/deprecated_builder_example.rb

Summary

Maintainability
A
0 mins
Test Coverage
# -*- coding: utf-8 -*-
# We will continue to support GEPUB::Builder works fine on version 1.x, but Builder will not be updated any more. For example, landmarks are not supported with Builder.

    require 'rubygems'
    require 'gepub'
    workdir = 'epub/example/'
    builder = GEPUB::Builder.new {
      unique_identifier 'http:/example.jp/bookid_in_url', 'BookID', 'URL'
      language 'en'

      title 'GEPUB Sample Book'
      subtitle 'This book is just a sample'
      alt 'ja' => 'これはあくまでサンプルです'

      creator 'KOJIMA Satoshi'
      alt 'ja' => '小嶋智'

      contributors 'Denshobu', 'Asagaya Densho', 'Shonan Densho Teidan', 'eMagazine Torutaru'

      date '2012-02-29T00:00:00Z'

      resources(:workdir => workdir) {
        cover_image 'img/image1.jpg' => 'image1.jpg'
        ordered {
          file 'text/chap1.xhtml'
          heading 'Chapter 1'
          file 'text/chap1-1.xhtml'
          file 'text/chap2.html'
          heading 'Chapter 2'
        }
      }
    }
    epubname = File.join(File.dirname(__FILE__), 'example_test_with_builder.epub')
    builder.generate_epub(epubname)