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/.gitignore +3 -1
- data/.travis.yml +6 -0
- data/README.rdoc +9 -55
- data/bin/gepuber +11 -6
- data/examples/generate_example.rb +52 -0
- data/examples/image1.jpg +0 -0
- data/gepub.gemspec +3 -4
- data/lib/gepub/book.rb +154 -176
- data/lib/gepub/gepuber.rb +6 -2
- data/lib/gepub/item.rb +66 -7
- data/lib/gepub/manifest.rb +78 -0
- data/lib/gepub/meta.rb +119 -0
- data/lib/gepub/metadata.rb +230 -0
- data/lib/gepub/package.rb +232 -0
- data/lib/gepub/spine.rb +112 -0
- data/lib/gepub/version.rb +1 -1
- data/lib/gepub/xml_util.rb +25 -0
- data/lib/gepub.rb +16 -0
- data/spec/example_spec.rb +53 -0
- data/spec/fixtures/epubcheck-3.0b4/COPYING.txt +19 -0
- data/spec/fixtures/epubcheck-3.0b4/README.txt +61 -0
- data/spec/fixtures/epubcheck-3.0b4/epubcheck-3.0b4.jar +0 -0
- data/spec/fixtures/epubcheck-3.0b4/jing_license.txt +12 -0
- data/spec/fixtures/epubcheck-3.0b4/lib/commons-compress-1.2.jar +0 -0
- data/spec/fixtures/epubcheck-3.0b4/lib/cssparser-0.9.6.jar +0 -0
- data/spec/fixtures/epubcheck-3.0b4/lib/jing.jar +0 -0
- data/spec/fixtures/epubcheck-3.0b4/lib/sac-1.3.jar +0 -0
- data/spec/fixtures/epubcheck-3.0b4/lib/saxon9he.jar +0 -0
- data/spec/fixtures/testdata/image1.jpg +0 -0
- data/spec/fixtures/testdata/test.opf +60 -0
- data/spec/gepub_spec.rb +57 -17
- data/spec/gepuber_spec.rb +8 -8
- data/spec/manifest_spec.rb +36 -0
- data/spec/metadata_spec.rb +170 -0
- data/spec/package_spec.rb +98 -0
- data/spec/spine_spec.rb +41 -0
- metadata +53 -23
- data/examples/example.rb +0 -49
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
|
-
|