epub_book 0.1.25 → 0.1.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/epub_book/book.rb +10 -4
- 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: ae4f4169c296cb59729448bb121afacba00aa2a72c7818dc9351c98df346162e
|
4
|
+
data.tar.gz: da0c7ed0365cf0b4fc4e628cbc4eb0723abfc8ee95d7e26c0e87f007206793d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1efc93cf78e29046f6ba2d5027c7cc388e632bc17823c6f50ff2a13515f44490afa8683e696f60c5beda4864410f946795ad6c5b0112cbbef4824d4048ec347b
|
7
|
+
data.tar.gz: 75dfac752c113f9136b4f4d86541ed7bbc2b76d398466a441aa24c2415d3bac66099c8975f4428bd75cc8a16d9e87054d6f1fd4f6cee94f7039fd1fd8577aa91
|
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
|
+
text_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}"
|
@@ -226,8 +232,8 @@ module EpubBook
|
|
226
232
|
EpubBook.logger.info str.encoding
|
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
|
-
str.scrub('')
|
230
|
-
str.encode!('utf-8') if str.encoding.name != 'UTF-8'
|
235
|
+
str.scrub!('') unless str.valid_encoding?
|
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.28
|
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
|