ebook_tools 0.1.3 → 0.1.4
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.
- data/CHANGELOG +3 -1
- data/ebook_tools.gemspec +1 -1
- data/lib/ebook_tools.rb +8 -2
- metadata +1 -1
data/CHANGELOG
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
0.1.4 2013.5.28
|
2
|
+
fix bug: 修复被遗漏修改的代码
|
3
|
+
|
1
4
|
0.1.3 2013.5.27
|
2
5
|
fix bug: 提取目录结构时目标路径为完整路径
|
3
6
|
|
@@ -5,7 +8,6 @@
|
|
5
8
|
fix bug: 对没有检测到目录结构的书进行错误标注
|
6
9
|
new: 新增异步导入paras
|
7
10
|
|
8
|
-
|
9
11
|
0.1.1 2013.5.26
|
10
12
|
fix bug: 提取目录结构时文本内容开始部分存在全角空格而无法正确提取目录结构
|
11
13
|
fix bug: 无法提取文本目录中包含“?”等标点符号的目录
|
data/ebook_tools.gemspec
CHANGED
data/lib/ebook_tools.rb
CHANGED
@@ -242,7 +242,7 @@ module EbookTools
|
|
242
242
|
files.each do |file|
|
243
243
|
extname = File.extname(file)
|
244
244
|
basename = File.basename(file,extname)
|
245
|
-
dest_file = File.join(File.dirname(File.join(dest_path,file.gsub(
|
245
|
+
dest_file = File.join(File.dirname(File.join(dest_path,file.gsub(source_path,''))),"#{basename}.xml")
|
246
246
|
if allow_extract_struct?(file)
|
247
247
|
puts "start extract #{file} ..."
|
248
248
|
begin
|
@@ -273,7 +273,13 @@ module EbookTools
|
|
273
273
|
|
274
274
|
def extract_text_from_file(filename,format)
|
275
275
|
txt_file = File.basename(filename,format)
|
276
|
-
|
276
|
+
if !filename.include?("'")
|
277
|
+
cmd = %Q(ebook-convert '#{filename}' '#{txt_file}.txt')
|
278
|
+
elsif !filename.include?('"')
|
279
|
+
cmd = %Q(ebook-convert "#{filename}" "#{txt_file}.txt")
|
280
|
+
else
|
281
|
+
cmd = %Q(ebook-convert #{filename} #{txt_file}.txt)
|
282
|
+
end
|
277
283
|
output = `#{cmd}`
|
278
284
|
content = File.open("#{txt_file}.txt").read
|
279
285
|
FileUtils.remove_file("#{txt_file}.txt",true)
|