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 +1 -1
- data/lib/gepub/generator.rb +12 -6
- data/spec/gepub_spec.rb +4 -4
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.8
|
data/lib/gepub/generator.rb
CHANGED
@@ -80,8 +80,8 @@ module GEPUB
|
|
80
80
|
@toc.push({ :id => id, :text => text, :ref => ref})
|
81
81
|
end
|
82
82
|
|
83
|
-
def
|
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
|
-
|
165
|
-
|
166
|
-
node['
|
167
|
-
node['
|
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.
|
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
|