epub_book 0.1.26 → 0.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/epub_book/book.rb +9 -3
- data/lib/epub_book/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10adea71e28883b5d5f9b6ca8f552637610583879338cc9258cfcfc087d41c1a
|
4
|
+
data.tar.gz: f241723275f5d139f4e202f025cd4ed37701c0268cf9a2f030368824472585d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ed9b98961ce16f0db4f0fc9a54ff389e8a31a578dc2988f48f9b793f4109fb219471c793b6a4ca38256f592ffb72e9428fc023b52308cc39346201e7c51d89e
|
7
|
+
data.tar.gz: df711aff69ea22f47c25171eeb49e268dde5ac22a380cd92fdcd9fa8deab4e627bee19f86343015bb16d381ad72149067d2506126de8136cf036bee73abb1ffa
|
data/lib/epub_book/book.rb
CHANGED
@@ -198,8 +198,14 @@ module EpubBook
|
|
198
198
|
else
|
199
199
|
txt_file.write("\n\n")
|
200
200
|
txt_file.write(item[:label])
|
201
|
-
txt_file.write("\n
|
202
|
-
|
201
|
+
txt_file.write("\n")
|
202
|
+
doc_file.css(@body_css).children.each do |it|
|
203
|
+
if it.name == 'text'
|
204
|
+
txt_file.write(it.text)
|
205
|
+
txt_file.write("\n")
|
206
|
+
end
|
207
|
+
end
|
208
|
+
#txt_file.write(doc_file.css(@body_css).text)
|
203
209
|
end
|
204
210
|
rescue Exception => e
|
205
211
|
EpubBook.logger.info "Error:#{e.message},#{item.inspect}"
|
@@ -227,7 +233,7 @@ module EpubBook
|
|
227
233
|
#/<meta.*?charset\s*=[\s\"\']?utf-8/i =~ str ? str : str.force_encoding('gbk').encode!('utf-8',invalid: :replace, undef: :replace)
|
228
234
|
|
229
235
|
str.scrub!('') unless str.valid_encoding?
|
230
|
-
str.encode!('utf-8') if str.encoding.name != 'UTF-8'
|
236
|
+
str.encode!('utf-8', invalid: :replace, undef: :replace, replace: '------') if str.encoding.name != 'UTF-8'
|
231
237
|
|
232
238
|
EpubBook.logger.info "-------encode 后 #{str.encoding}"
|
233
239
|
str
|
data/lib/epub_book/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epub_book
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- qmliu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|