gepub 0.6.8 → 0.6.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitattributes +49 -0
- data/lib/gepub/metadata.rb +1 -1
- data/lib/gepub/package.rb +7 -12
- data/lib/gepub/resource_builder.rb +4 -0
- data/lib/gepub/version.rb +1 -1
- data/lib/gepub.rb +1 -0
- data/spec/fixtures/testdata/package_2_0.opf +2 -0
- data/spec/metadata_spec.rb +7 -1
- data/spec/package_spec.rb +1 -0
- metadata +9 -8
data/.gitattributes
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
*.doc diff=astextplain
|
2
|
+
*.DOC diff=astextplain
|
3
|
+
*.docx diff=astextplain
|
4
|
+
*.DOCX diff=astextplain
|
5
|
+
*.dot diff=astextplain
|
6
|
+
*.DOT diff=astextplain
|
7
|
+
*.pdf diff=astextplain
|
8
|
+
*.PDF diff=astextplain
|
9
|
+
*.rtf diff=astextplain
|
10
|
+
*.RTF diff=astextplain
|
11
|
+
|
12
|
+
*.jpg binary
|
13
|
+
*.png binary
|
14
|
+
*.gif binary
|
15
|
+
|
16
|
+
*.cs text=auto diff=csharp
|
17
|
+
*.vb text=auto
|
18
|
+
*.c text=auto
|
19
|
+
*.cpp text=auto
|
20
|
+
*.cxx text=auto
|
21
|
+
*.h text=auto
|
22
|
+
*.hxx text=auto
|
23
|
+
*.py text=auto
|
24
|
+
*.rb text=auto
|
25
|
+
*.java text=auto
|
26
|
+
*.html text=auto
|
27
|
+
*.htm text=auto
|
28
|
+
*.css text=auto
|
29
|
+
*.scss text=auto
|
30
|
+
*.sass text=auto
|
31
|
+
*.less text=auto
|
32
|
+
*.js text=auto
|
33
|
+
*.lisp text=auto
|
34
|
+
*.clj text=auto
|
35
|
+
*.sql text=auto
|
36
|
+
*.php text=auto
|
37
|
+
*.lua text=auto
|
38
|
+
*.m text=auto
|
39
|
+
*.asm text=auto
|
40
|
+
*.erl text=auto
|
41
|
+
*.fs text=auto
|
42
|
+
*.fsx text=auto
|
43
|
+
*.hs text=auto
|
44
|
+
|
45
|
+
*.csproj text=auto merge=union
|
46
|
+
*.vbproj text=auto merge=union
|
47
|
+
*.fsproj text=auto merge=union
|
48
|
+
*.dbproj text=auto merge=union
|
49
|
+
*.sln text=auto eol=crlf merge=union
|
data/lib/gepub/metadata.rb
CHANGED
@@ -84,7 +84,7 @@ module GEPUB
|
|
84
84
|
@oldstyle_meta = []
|
85
85
|
end
|
86
86
|
|
87
|
-
CONTENT_NODE_LIST = ['identifier','title', 'language', 'contributor', 'creator', 'coverage', 'date','description','format
|
87
|
+
CONTENT_NODE_LIST = ['identifier','title', 'language', 'contributor', 'creator', 'coverage', 'date','description','format','publisher','relation','rights','source','subject','type'].each {
|
88
88
|
|node|
|
89
89
|
define_method(node + '_list') { @content_nodes[node].dup }
|
90
90
|
define_method(node + '_clear') {
|
data/lib/gepub/package.rb
CHANGED
@@ -5,7 +5,14 @@ module GEPUB
|
|
5
5
|
# Holds data in opf file.
|
6
6
|
class Package
|
7
7
|
include XMLUtil
|
8
|
+
extend Forwardable
|
8
9
|
attr_accessor :path, :metadata, :manifest, :spine, :bindings, :epub_backward_compat, :contents_prefix
|
10
|
+
def_delegators :@manifest, :item_by_href
|
11
|
+
def_delegators :@metadata, *Metadata::CONTENT_NODE_LIST.map {
|
12
|
+
|x|
|
13
|
+
["#{x}", "#{x}_list", "set_#{x}", "#{x}=", "add_#{x}"]
|
14
|
+
}.flatten
|
15
|
+
|
9
16
|
|
10
17
|
class IDPool
|
11
18
|
def initialize
|
@@ -152,18 +159,6 @@ module GEPUB
|
|
152
159
|
@manifest.item_list
|
153
160
|
end
|
154
161
|
|
155
|
-
def method_missing(name, *args)
|
156
|
-
return @manifest.send(name.to_sym, *args) if [:item_by_href].member? name
|
157
|
-
Metadata::CONTENT_NODE_LIST.each {
|
158
|
-
|x|
|
159
|
-
case name.to_s
|
160
|
-
when x, "#{x}_list", "set_#{x}", "#{x}=", "add_#{x}"
|
161
|
-
return @metadata.send(name, *args)
|
162
|
-
end
|
163
|
-
}
|
164
|
-
super
|
165
|
-
end
|
166
|
-
|
167
162
|
def author=(val)
|
168
163
|
warn 'author= is deprecated. please use #creator'
|
169
164
|
@metadata.creator= val
|
data/lib/gepub/version.rb
CHANGED
data/lib/gepub.rb
CHANGED
@@ -8,8 +8,10 @@
|
|
8
8
|
<dc:date>2010-05-05</dc:date>
|
9
9
|
<dc:identifier id="BookId">http://example.jp/foobar/</dc:identifier>
|
10
10
|
<dc:language>ja</dc:language>
|
11
|
+
<meta name="cover" content="cover-image" />
|
11
12
|
</metadata>
|
12
13
|
<manifest>
|
14
|
+
<item id="cover-image" href="img/cover.jpg" properties="cover-image" media-type="image/jpeg" />
|
13
15
|
<item id="c1" href="text/foobar.xhtml" media-type="application/xhtml+xml"/>
|
14
16
|
<item id="c2" href="text/barbar.xhtml" media-type="application/xhtml+xml"/>
|
15
17
|
<item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
|
data/spec/metadata_spec.rb
CHANGED
@@ -62,7 +62,13 @@ describe GEPUB::Metadata do
|
|
62
62
|
it 'should parse title' do
|
63
63
|
@metadata.main_title.should == 'thetitle'
|
64
64
|
@metadata.title_list.size.should == 1
|
65
|
-
|
65
|
+
end
|
66
|
+
it 'should parse OPF2.0 meta node' do
|
67
|
+
@metadata.oldstyle_meta.size.should == 1
|
68
|
+
@metadata.oldstyle_meta[0].name == 'meta'
|
69
|
+
@metadata.oldstyle_meta[0]['name'] == 'cover'
|
70
|
+
@metadata.oldstyle_meta[0]['content'] == 'cover-image'
|
71
|
+
end
|
66
72
|
end
|
67
73
|
|
68
74
|
context 'Generate New OPF' do
|
data/spec/package_spec.rb
CHANGED
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.8
|
4
|
+
version: 0.6.8.3
|
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-07-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70101613986380 !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: *70101613986380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: nokogiri
|
27
|
-
requirement: &
|
27
|
+
requirement: &70101613984580 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.5.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70101613984580
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rubyzip
|
38
|
-
requirement: &
|
38
|
+
requirement: &70101613994180 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 0.9.7
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70101613994180
|
47
47
|
description: gepub is a generic EPUB parser/generator. Generates and parse EPUB2 and
|
48
48
|
EPUB3
|
49
49
|
email:
|
@@ -54,6 +54,7 @@ executables:
|
|
54
54
|
extensions: []
|
55
55
|
extra_rdoc_files: []
|
56
56
|
files:
|
57
|
+
- .gitattributes
|
57
58
|
- .gitignore
|
58
59
|
- .travis.yml
|
59
60
|
- Gemfile
|