kindler 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kindler/version.rb +1 -1
- data/lib/kindler.rb +3 -9
- data/lib/templates/book.opf.erb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cbe607a78915ed4694db86aebec44e4df52ed67
|
4
|
+
data.tar.gz: 24225c4c41a29ab3589b7253727913a748d9413e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b77b704a3cfd0ebb3167dcd1b461a79597ef5992b031937318c0e57b9d41fcabf15adc849b0bc631294d2a1e14dd626e9463c3827fb02d52235a8819e482e670
|
7
|
+
data.tar.gz: c71af00a5c240d48703bef1dec20cc2a485ca7466f13540e3bf6e92a1d1bab3896305782ab1e14e67ea23ce4c3848a268ca6177ea5e8640c993f62316f949e4c
|
data/lib/kindler/version.rb
CHANGED
data/lib/kindler.rb
CHANGED
@@ -14,7 +14,7 @@ module Kindler
|
|
14
14
|
class Book
|
15
15
|
class KindlerError < StandardError;end
|
16
16
|
|
17
|
-
attr_accessor :title,:author,:pages,:pages_by_section,:local_images,:mobi_type,:style
|
17
|
+
attr_accessor :title,:author,:pages,:pages_by_section,:local_images,:mobi_type,:style,:cover_image
|
18
18
|
|
19
19
|
TMP_DIR_PREFIX = '__km_'
|
20
20
|
DEFAULT_SECTION = "All Pages"
|
@@ -65,6 +65,7 @@ module Kindler
|
|
65
65
|
def generate
|
66
66
|
make_generated_dirs
|
67
67
|
localize_images if @keep_image
|
68
|
+
prepare_conver_img
|
68
69
|
# reorder count index
|
69
70
|
if magzine?
|
70
71
|
sectionize_pages
|
@@ -73,7 +74,6 @@ module Kindler
|
|
73
74
|
generate_opf
|
74
75
|
generate_ncx
|
75
76
|
write_to_disk
|
76
|
-
prepare_conver_img
|
77
77
|
kindlegen
|
78
78
|
end
|
79
79
|
|
@@ -204,13 +204,7 @@ module Kindler
|
|
204
204
|
end
|
205
205
|
|
206
206
|
def prepare_conver_img
|
207
|
-
|
208
|
-
if @cover.start_with?("http")
|
209
|
-
# download conver to conver
|
210
|
-
# TODO find out a elegant way to do this
|
211
|
-
else
|
212
|
-
`cp #{@cover} #{tmp_dir}/` if File.exist?(@cover)
|
213
|
-
end
|
207
|
+
@cover_image = File.basename(@local_images.first) rescue ''
|
214
208
|
end
|
215
209
|
|
216
210
|
# create dirs of generated files
|
data/lib/templates/book.opf.erb
CHANGED
@@ -22,6 +22,7 @@
|
|
22
22
|
<% pages.each_with_index do |page,index|%>
|
23
23
|
<item href='<%= (index+1).to_s.rjust(3,'0') %>.html' media-type='application/xhtml+xml' id='<%= (index+1).to_s.rjust(3,'0') %>'/>
|
24
24
|
<% end %>
|
25
|
+
<item href="<%= cover_image %>" id="cover-image" media-type="image/jpeg" />
|
25
26
|
<item href='contents.html' media-type='application/xhtml+xml' id='contents'/>
|
26
27
|
<item href='nav-contents.ncx' media-type='application/x-dtbncx+xml' id='nav-contents'/>
|
27
28
|
</manifest>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kindler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dongbin.li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|