mkbok 0.0.7 → 0.0.8

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.
Files changed (3) hide show
  1. data/bin/mkbok +14 -7
  2. data/lib/mkbok_version.rb +1 -1
  3. metadata +2 -2
data/bin/mkbok CHANGED
@@ -276,13 +276,20 @@ def generate_pdf(options)
276
276
  cd($root)
277
277
  3.times do |i|
278
278
  print "\t\tPass #{i + 1}... "
279
- IO.popen("xelatex -output-directory=\"#{dir}\" \"#{dir}/main.tex\" 2>&1",'r:UTF-16LE:UTF-8') do |pipe|
279
+ line = ""
280
+ IO.popen("xelatex -output-directory=\"#{dir}\" \"#{dir}/main.tex\" 2>&1") do |pipe|
280
281
  unless $DEBUG
281
- if ~ /^!\s/
282
- puts "failed with:\n\t\t\t#{$_.strip}"
283
- puts "\tConsider running this again with --debug."
284
- abort = true
285
- end while pipe.gets and not abort
282
+ while line = pipe.gets and not abort
283
+ # print line.encoding.name
284
+ # use different way to handle encoding issues for ruby
285
+ if (RUBY_VERSION >= "1.9" and line.valid_encoding? and line =~ /^!\s/) or (RUBY_VERSION < "1.9" and line =~ /^!\s/)
286
+ puts "failed with:\n\t\t\t#{line.strip}"
287
+ puts "\tConsider running this again with --debug."
288
+ abort = true
289
+ end
290
+ end
291
+
292
+ #print line while line = pipe.gets
286
293
  else
287
294
  STDERR.print while pipe.gets rescue abort = true
288
295
  end
@@ -310,7 +317,7 @@ def generate_ebook(options)
310
317
  puts "Will generate ebooks [#{options["outputformat"].join(',')}] for the following languages #{options["lang"]}"
311
318
  puts " "
312
319
 
313
- options["lang"].each do |lang|
320
+ options["lang"].split(',').each do |lang|
314
321
  puts "convert content for '#{lang}' language"
315
322
 
316
323
  if lang == 'zh'
data/lib/mkbok_version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module MkBok
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mkbok
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-12 00:00:00.000000000 Z
12
+ date: 2012-02-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: the ebook generate tools from markdown plain text
15
15
  email: