gepub 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
@@ -80,8 +80,8 @@ module GEPUB
80
80
  @toc.push({ :id => id, :text => text, :ref => ref})
81
81
  end
82
82
 
83
- def addCoverImage(id, href)
84
-
83
+ def specifyCoverImage(id)
84
+ @metadata[:cover] = id
85
85
  end
86
86
 
87
87
  def create(destdir)
@@ -161,10 +161,16 @@ EOF
161
161
  metadataelem << XML::Node.new('dc:language', 'ja')
162
162
 
163
163
  @metadata.each { | k, v |
164
- metadataelem << node = XML::Node.new("dc:#{k}",v)
165
- if (k == :identifier)
166
- node['id'] = 'BookID'
167
- node['opf:scheme'] = 'URL'
164
+ if (k == :cover)
165
+ metadataelem << node = XML::Node.new("meta")
166
+ node['name'] = 'cover'
167
+ node['content'] = v
168
+ else
169
+ metadataelem << node = XML::Node.new("dc:#{k}",v)
170
+ if (k == :identifier)
171
+ node['id'] = 'BookID'
172
+ node['opf:scheme'] = 'URL'
173
+ end
168
174
  end
169
175
  }
170
176
 
data/spec/gepub_spec.rb CHANGED
@@ -97,17 +97,17 @@ describe GEPUB::Generator do
97
97
  spine.find_first('a:itemref')['idref'].should == 'c1'
98
98
  end
99
99
 
100
- it "should have correct cover image" do
100
+ it "should have correct cover image id" do
101
101
 
102
- @generator.addCoverImage("theId", "path/to/cover.jpg")
102
+ @generator.specifyCoverImage("theId")
103
103
  opf = LibXML::XML::Parser.string(@generator.opf_xml).parse
104
104
  opf.root.namespaces.default_prefix='a'
105
105
 
106
106
  metadata = opf.find_first('a:metadata')
107
- metacover = metadata.find_first('meta')
107
+ metacover = metadata.find_first('a:meta')
108
108
  metacover['name'].should == 'cover'
109
109
  metacover['content'].should == 'theId'
110
-
110
+
111
111
  end
112
112
 
113
113
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 7
9
- version: 0.0.7
8
+ - 8
9
+ version: 0.0.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - KOJIMA Satoshi