gepub 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/examples/example.rb DELETED
@@ -1,49 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'rubygems'
3
- require 'gepub'
4
- require 'fileutils'
5
-
6
- epubname = "testepub.epub"
7
- title = "samplepub"
8
-
9
- epub = GEPUB::Book.new(title)
10
- epub.author="the author"
11
- epub.publisher="the publisher"
12
- epub.date = "2010-05-03"
13
- epub.identifier = "http://www.skoji.jp/testepub/2010-05-03"
14
-
15
- # create test contents files
16
-
17
- contents = {}
18
- [ 'coverpage', 'chapter1', 'chapter2' ].each {
19
- |name|
20
- contents[name] = <<EOF
21
- <?xml version="1.0" encoding="UTF-8"?>
22
- <html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
23
- <head>
24
- <title>sample #{name} </title>
25
- </head>
26
- <body>
27
- <h1>#{name}</h1>
28
- <p>here comes the contents for #{name}</p>
29
- </body>
30
- </html>
31
- EOF
32
- }
33
-
34
- # coverpage won't appear on toc, so do not call addNav
35
- epub.spine << epub.add_item('coverpage.html', StringIO.new(contents['coverpage']))
36
- chap1 = epub.add_item("chapter1.html", StringIO.new(contents['chapter1']))
37
- epub.spine << chap1
38
- epub.add_nav(chap1, 'Chapter 1')
39
- chap2 = epub.add_item("chapter2.html", StringIO.new(contents['chapter2']))
40
- epub.spine << chap2
41
- # if there are image files, they need not add to spine.
42
- epub.add_nav(chap2, 'Chapter 2')
43
-
44
- # GEPUB::Book#add_ordered_item will added on <manifest> and <spine> section.
45
- # if you want to add image file, use GEPUB::Book#add_item instead.
46
- epub.generate_epub(epubname)
47
-
48
-
49
-