gepub 0.6.6 → 0.6.8
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/README.md +2 -2
- data/gepub.gemspec +1 -1
- data/lib/gepub/metadata.rb +2 -2
- data/lib/gepub/version.rb +1 -1
- data/lib/gepub.rb +0 -2
- data/spec/fixtures/testdata/package_2_0.opf +21 -0
- data/spec/metadata_spec.rb +10 -0
- data/spec/spec_helper.rb +21 -0
- metadata +12 -11
- data/lib/gepub/rubyzip_patch.rb +0 -11
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# gepub [<img src="https://secure.travis-ci.org/skoji/gepub.png" />](http://travis-ci.org/skoji/gepub)
|
1
|
+
# gepub [<img src="https://secure.travis-ci.org/skoji/gepub.png" />](http://travis-ci.org/skoji/gepub) [<img src="https://gemnasium.com/skoji/gepub.png" />](https://gemnasium.com/skoji/gepub)
|
2
2
|
|
3
|
-
* http://
|
3
|
+
* http://en.skoji.jp/category/gepub/
|
4
4
|
|
5
5
|
## DESCRIPTION:
|
6
6
|
|
data/gepub.gemspec
CHANGED
data/lib/gepub/metadata.rb
CHANGED
@@ -47,7 +47,7 @@ module GEPUB
|
|
47
47
|
@oldstyle_meta = []
|
48
48
|
@opf_version = opf_version
|
49
49
|
@namespaces = { 'xmlns:dc' => DC_NS }
|
50
|
-
@namespaces['xmlns:opf'] = OPF_NS if @opf_version.to_f < 3.0
|
50
|
+
@namespaces['xmlns:opf'] = OPF_NS if @opf_version.to_f < 3.0
|
51
51
|
yield self if block_given?
|
52
52
|
end
|
53
53
|
|
@@ -252,7 +252,7 @@ module GEPUB
|
|
252
252
|
end
|
253
253
|
|
254
254
|
def parse_opf2_meta
|
255
|
-
@xml.xpath("#{ns_prefix(OPF_NS)}:meta[not(@refines) and not(@property)]").map {
|
255
|
+
@xml.xpath("#{ns_prefix(OPF_NS)}:meta[not(@refines) and not(@property)]", @namespaces).map {
|
256
256
|
|node|
|
257
257
|
create_meta(node)
|
258
258
|
}
|
data/lib/gepub/version.rb
CHANGED
data/lib/gepub.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="BookId">
|
3
|
+
<metadata xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
4
|
+
<dc:title>thetitle</dc:title>
|
5
|
+
<dc:creator>theauthor</dc:creator>
|
6
|
+
<dc:contributor>contributors contributors!</dc:contributor>
|
7
|
+
<dc:publisher>thepublisher</dc:publisher>
|
8
|
+
<dc:date>2010-05-05</dc:date>
|
9
|
+
<dc:identifier id="BookId">http://example.jp/foobar/</dc:identifier>
|
10
|
+
<dc:language>ja</dc:language>
|
11
|
+
</metadata>
|
12
|
+
<manifest>
|
13
|
+
<item id="c1" href="text/foobar.xhtml" media-type="application/xhtml+xml"/>
|
14
|
+
<item id="c2" href="text/barbar.xhtml" media-type="application/xhtml+xml"/>
|
15
|
+
<item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
|
16
|
+
</manifest>
|
17
|
+
<spine toc="ncx">
|
18
|
+
<itemref idref="c1"/>
|
19
|
+
<itemref idref="c2"/>
|
20
|
+
</spine>
|
21
|
+
</package>
|
data/spec/metadata_spec.rb
CHANGED
@@ -55,6 +55,16 @@ describe GEPUB::Metadata do
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
context 'Should parse OPF2.0' do
|
59
|
+
before do
|
60
|
+
@metadata = GEPUB::Package.parse_opf(File.open(File.dirname(__FILE__) + '/fixtures/testdata/package_2_0.opf'), '/package.opf').instance_eval{ @metadata }
|
61
|
+
end
|
62
|
+
it 'should parse title' do
|
63
|
+
@metadata.main_title.should == 'thetitle'
|
64
|
+
@metadata.title_list.size.should == 1
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
58
68
|
context 'Generate New OPF' do
|
59
69
|
it 'should write and read identifier' do
|
60
70
|
metadata = GEPUB::Metadata.new
|
data/spec/spec_helper.rb
CHANGED
@@ -6,5 +6,26 @@ rescue LoadError
|
|
6
6
|
require 'spec'
|
7
7
|
end
|
8
8
|
|
9
|
+
RSpec.configure do |config|
|
10
|
+
# Use color in STDOUT
|
11
|
+
config.color_enabled = true
|
12
|
+
# Use color not only in STDOUT but also in pagers and files
|
13
|
+
config.tty = true
|
14
|
+
# Use the specified formatter
|
15
|
+
config.formatter = :documentation # :progress, :html, :textmate
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'rspec/core/formatters/base_text_formatter'
|
19
|
+
module RSpec
|
20
|
+
module Core
|
21
|
+
module Formatters
|
22
|
+
class DocumentationFormatter < BaseTextFormatter
|
23
|
+
# def green(text); color(text, "\e[42m") end
|
24
|
+
def red(text); color(text, "\e[41m") end
|
25
|
+
# def magenta(text); color(text, "\e[45m") end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
9
30
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
10
31
|
require 'gepub'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gepub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70190075871760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70190075871760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: nokogiri
|
27
|
-
requirement: &
|
27
|
+
requirement: &70190075871260 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,18 +32,18 @@ dependencies:
|
|
32
32
|
version: 1.5.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70190075871260
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rubyzip
|
38
|
-
requirement: &
|
38
|
+
requirement: &70190075870800 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.9.
|
43
|
+
version: 0.9.7
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70190075870800
|
47
47
|
description: gepub is a generic EPUB parser/generator. Generates and parse EPUB2 and
|
48
48
|
EPUB3
|
49
49
|
email:
|
@@ -78,7 +78,6 @@ files:
|
|
78
78
|
- lib/gepub/metadata.rb
|
79
79
|
- lib/gepub/package.rb
|
80
80
|
- lib/gepub/resource_builder.rb
|
81
|
-
- lib/gepub/rubyzip_patch.rb
|
82
81
|
- lib/gepub/spine.rb
|
83
82
|
- lib/gepub/version.rb
|
84
83
|
- lib/gepub/xml_util.rb
|
@@ -104,6 +103,7 @@ files:
|
|
104
103
|
- spec/fixtures/testdata/0.html
|
105
104
|
- spec/fixtures/testdata/1.html
|
106
105
|
- spec/fixtures/testdata/image1.jpg
|
106
|
+
- spec/fixtures/testdata/package_2_0.opf
|
107
107
|
- spec/fixtures/testdata/test.opf
|
108
108
|
- spec/fixtures/testdata/test2.opf
|
109
109
|
- spec/fixtures/testdata/test_with_bindings.opf
|
@@ -160,6 +160,7 @@ test_files:
|
|
160
160
|
- spec/fixtures/testdata/0.html
|
161
161
|
- spec/fixtures/testdata/1.html
|
162
162
|
- spec/fixtures/testdata/image1.jpg
|
163
|
+
- spec/fixtures/testdata/package_2_0.opf
|
163
164
|
- spec/fixtures/testdata/test.opf
|
164
165
|
- spec/fixtures/testdata/test2.opf
|
165
166
|
- spec/fixtures/testdata/test_with_bindings.opf
|
data/lib/gepub/rubyzip_patch.rb
DELETED