epub-parser 0.1.7.1 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +7 -0
- data/README.markdown +6 -0
- data/docs/Home.markdown +1 -1
- data/lib/epub/parser/ocf.rb +2 -2
- data/lib/epub/parser/publication.rb +2 -1
- data/lib/epub/parser/version.rb +1 -1
- data/lib/epub/publication/package/manifest.rb +2 -1
- data/test/test_searcher.rb +1 -1
- 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: 0e0b5095d398c04f70b55444777389325b51b34a
|
4
|
+
data.tar.gz: f34bca3b4e1f8840b4caa58b11ffc00b95855794
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd4a31dca34f82fbc9eca34f53b3b5806c99cb91257c7efe97b1f1eca35edcf9beda7a38ee62eb3a43953587beab6283353fb94e9add1858acdb599750c32ee3
|
7
|
+
data.tar.gz: 719e99aad4b05a6f784e9c69f438f98319be7c330f70fb79531e41d1ec9b027893de4d01875f0ee3cca23a443606f744c6699c7e635159145bfeeeed07fd41f3
|
data/CHANGELOG.markdown
CHANGED
data/README.markdown
CHANGED
@@ -110,6 +110,12 @@ If you find other gems, please tell me or request a pull request.
|
|
110
110
|
RECENT CHANGES
|
111
111
|
--------------
|
112
112
|
|
113
|
+
### 0.1.8
|
114
|
+
|
115
|
+
* Explicity #close each zip member file that has been opened via #fopen(Thanks [xunker][]!)
|
116
|
+
|
117
|
+
[xunker]: https://github.com/xunker
|
118
|
+
|
113
119
|
### 0.1.7.1
|
114
120
|
|
115
121
|
* Don't set encoding when content is not text
|
data/docs/Home.markdown
CHANGED
@@ -44,7 +44,7 @@ This book object can yield page by spine's order(spine defines the order to read
|
|
44
44
|
book.each_page_on_spine do |page|
|
45
45
|
file = page.href # => path/to/page/in/zip/archive
|
46
46
|
html = Zip::Archive.open('/path/to/book.epub') {|zip|
|
47
|
-
zip.fopen(file.to_s).read
|
47
|
+
zip.fopen(file.to_s) {|file| file.read}
|
48
48
|
}
|
49
49
|
end
|
50
50
|
|
data/lib/epub/parser/ocf.rb
CHANGED
@@ -25,8 +25,8 @@ module EPUB
|
|
25
25
|
def parse
|
26
26
|
EPUB::OCF::MODULES.each do |m|
|
27
27
|
begin
|
28
|
-
|
29
|
-
@ocf.__send__ "#{m}=", __send__("parse_#{m}",
|
28
|
+
data = @zip.fopen(File.join(DIRECTORY, "#{m}.xml")) {|file| file.read}
|
29
|
+
@ocf.__send__ "#{m}=", __send__("parse_#{m}", data)
|
30
30
|
rescue Zip::Error
|
31
31
|
end
|
32
32
|
end
|
data/lib/epub/parser/version.rb
CHANGED
@@ -93,8 +93,9 @@ module EPUB
|
|
93
93
|
|
94
94
|
def read
|
95
95
|
raw_content = Zip::Archive.open(manifest.package.book.epub_file) {|zip|
|
96
|
-
zip.fopen(entry_name).read
|
96
|
+
zip.fopen(entry_name) {|member| member.read}
|
97
97
|
}
|
98
|
+
|
98
99
|
unless media_type.start_with?('text/') or
|
99
100
|
media_type.end_with?('xml') or
|
100
101
|
['application/json', 'application/javascript', 'application/ecmascript', 'application/xml-dtd'].include?(media_type)
|
data/test/test_searcher.rb
CHANGED
@@ -27,7 +27,7 @@ class TestSearcher < Test::Unit::TestCase
|
|
27
27
|
[[[:element, 2, {:name => 'spine', :id => nil}], [:itemref, 0, {:id => nil}], [:element, 1, {:name => 'body', :id => nil}], [:element, 0, {:name => 'div', :id => nil}], [:element, 0, {:name => 'nav', :id => 'idid'}], [:element, 0, {:name => 'hgroup', :id => nil}], [:element, 1, {:name => 'h1', :id => nil}], [:text, 0]], [[:character, 9]], [[:character, 16]]]
|
28
28
|
]),
|
29
29
|
EPUB::Searcher::Publication.search(@package, 'Content')
|
30
|
-
|
30
|
+
)
|
31
31
|
end
|
32
32
|
|
33
33
|
class TesetResult < self
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epub-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KITAITI Makoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|