ebook_tools 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ebook_tools}
5
- s.version = '0.1.3'
5
+ s.version = '0.1.4'
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Aaron"]
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(source,''))),"#{basename}.xml")
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
- cmd = %Q(ebook-convert #{filename} #{txt_file}.txt)
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ebook_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: