mkbok 0.0.2 → 0.0.3

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 +288 -274
  2. data/lib/mkbok_version.rb +1 -1
  3. metadata +2 -2
data/bin/mkbok CHANGED
@@ -1,274 +1,288 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'optparse'
4
- require 'fileutils'
5
- require 'erb'
6
- require 'yaml'
7
-
8
- include FileUtils
9
-
10
- options = {}
11
- CONFIG_FILE = File.join('.mkbok.yml')
12
- if File.exists? CONFIG_FILE
13
- config_options = YAML.load_file(CONFIG_FILE)
14
- options.merge!(config_options)
15
- end
16
-
17
- option_parser = OptionParser.new do |opts|
18
- executable_name = File.basename($PROGRAM_NAME)
19
- opts.banner = "make ebooks from markdown plain text
20
- Usage: #{executable_name} [options]
21
- "
22
- # Create a switch
23
- opts.on("-b","--build FORMAT","build") do |format|
24
- unless format=="pdf"
25
- raise ArgumentError,"FORMAT must be in 'pdf' format"
26
- end
27
- options[:build] = format
28
- end
29
- # Create a flag
30
- opts.on("-l","--lang LANG","language selection") do |lang|
31
- unless lang=="zh" or lang=="en"
32
- raise ArgumentError,"LANG must be in zh or en"
33
- end
34
- options[:lang] = lang
35
- end
36
- opts.on("-c","--config CONFIG","config file") do |config|
37
- unless File.exists? config
38
- raise ArgumentError,"config file \"#{config}\" doesn't exist"
39
- end
40
- options[:config] = config
41
- end
42
- opts.on("-t","--template template.tex","latex template file") do |template|
43
- unless File.exists? template
44
- raise ArgumentError,"template file \"#{template}\" doesn't exist"
45
- end
46
- options[:template] = template
47
- end
48
- opts.on("-n","--name book name","book name") do |name|
49
- unless name =~ /^[a-zA-Z0-9]+$/
50
- raise ArgumentError,"name should be [a-zA-Z0-9]"
51
- end
52
- options[:name] = name
53
- end
54
- end
55
-
56
- option_parser.parse!
57
- puts options.inspect
58
-
59
- $here = File.expand_path(File.dirname(__FILE__))
60
- $root = File.join($here)
61
- $outDir = File.join($root, 'pdf')
62
-
63
- def figures(&block)
64
- begin
65
- Dir["#$root/figures/18333*.png"].each do |file|
66
- cp(file, file.sub(/18333fig0(\d)0?(\d+)\-tn/, '\1.\2'))
67
- end
68
- block.call
69
- ensure
70
- Dir["#$root/figures/18333*.png"].each do |file|
71
- rm(file.gsub(/18333fig0(\d)0?(\d+)\-tn/, '\1.\2'))
72
- end
73
- end
74
- end
75
-
76
- def command_exists?(command)
77
- if File.executable?(command) then
78
- return command
79
- end
80
- ENV['PATH'].split(File::PATH_SEPARATOR).map do |path|
81
- cmd = "#{path}/#{command}"
82
- File.executable?(cmd) || File.executable?("#{cmd}.exe") || File.executable?("#{cmd}.cmd")
83
- end.inject{|a, b| a || b}
84
- end
85
-
86
- def replace(string, &block)
87
- string.instance_eval do
88
- alias :s :gsub!
89
- instance_eval(&block)
90
- end
91
- string
92
- end
93
-
94
- def verbatim_sanitize(string)
95
- string.gsub('\\', '{\textbackslash}').
96
- gsub('~', '{\textasciitilde}').
97
- gsub(/([\$\#\_\^\%])/, '\\\\' + '\1{}')
98
- end
99
-
100
- def pre_pandoc(string, config)
101
- replace(string) do
102
- s /\#\#\#\#\# (.*?) \#\#\#\#\#/, 'PARASECTION: \1'
103
- # Pandoc discards #### subsubsections #### - this hack recovers them
104
- s /\#\#\#\# (.*?) \#\#\#\#/, 'SUBSUBSECTION: \1'
105
-
106
- # Turns URLs into clickable links
107
- s /\`(http:\/\/[A-Za-z0-9\/\%\&\=\-\_\\\.]+)\`/, '<\1>'
108
- s /(\n\n)\t(http:\/\/[A-Za-z0-9\/\%\&\=\-\_\\\.]+)\n([^\t]|\t\n)/, '\1<\2>\1'
109
-
110
- # Process figures
111
- s /Insert\s18333fig\d+\.png\s*\n.*?\d{1,2}-\d{1,2}\. (.*)/, 'FIG: \1'
112
- end
113
- end
114
-
115
- def post_pandoc(string, config, lang, chapter=true)
116
- replace(string) do
117
- space = /\s/
118
-
119
- # Reformat for the book documentclass as opposed to article
120
- s '\section', '\chap'
121
- s '\sub', '\\'
122
- s /SUBSUBSECTION: (.*)/, '\subsubsection{\1}'
123
- s /PARASECTION: (.*)/, '\paragraph{\1}'
124
-
125
- # Enable proper cross-reference
126
- s /#{config['fig'].gsub(space, '\s')}\s*(\d+)\-\-(\d+)/, '\imgref{\1.\2}'
127
- s /#{config['tab'].gsub(space, '\s')}\s*(\d+)\-\-(\d+)/, '\tabref{\1.\2}'
128
- s /#{config['prechap'].gsub(space, '\s')}\s*(\d+)(\s*)#{config['postchap'].gsub(space, '\s')}/, '\chapref{\1}\2'
129
-
130
- # Miscellaneous fixes
131
- s /FIG: (.*)/, '\img{\1}'
132
- s '\begin{enumerate}[1.]', '\begin{enumerate}'
133
- s /(\w)--(\w)/, '\1-\2'
134
- s /``(.*?)''/, "#{config['dql']}\\1#{config['dqr']}"
135
-
136
- # Typeset the maths in the book with TeX
137
- s '\verb!p = (n(n-1)/2) * (1/2^160))!', '$p = \frac{n(n-1)}{2} \times \frac{1}{2^{160}}$)'
138
- s '2\^{}80', '$2^{80}$'
139
- s /\sx\s10\\\^\{\}(\d+)/, '\e{\1}'
140
-
141
- # Convert inline-verbatims into \texttt (which is able to wrap)
142
- s /\\verb(\W)(.*?)\1/ do
143
- "{\\texttt{#{verbatim_sanitize($2)}}}"
144
- end
145
-
146
- # Ensure monospaced stuff is in a smaller font
147
- s /(\\verb(\W).*?\2)/, '{\footnotesize\1}'
148
- s /(\\begin\{verbatim\}.*?\\end\{verbatim\})/m, '{\footnotesize\1}'
149
-
150
- # Shaded verbatim block
151
- s /(\\begin\{verbatim\}.*?\\end\{verbatim\})/m, '\begin{shaded}\1\end{shaded}'
152
-
153
- if lang=="zh"
154
- # http://www.devdaily.com/blog/post/latex/control-line-spacing-in-itemize-enumerate-tags
155
- # http://wiki.ctex.org/index.php/LaTeX/%E5%88%97%E8%A1%A8
156
- # set the space of itemsize
157
- s /(\\begin\{itemize\})/m,'\begin{itemize}\setlength{\itemsep}{1pt}\setlength{\parskip}{0pt}\setlength{\parsep}{0pt}'
158
- s /(\\begin\{enumerate\})/m,'\begin{enumerate}\setlength{\itemsep}{1pt}\setlength{\parskip}{0pt}\setlength{\parsep}{0pt}'
159
- # hardcode for itemize to use * instead of dot, which is missed in some chinese fonts
160
- # and keep \item inside \enumerate env is not changed
161
- # \item -> \item[*]
162
- # solution is provided by Alexis, and it works under ruby 1.9+ only due to bug in 1.8.7
163
- # http://stackoverflow.com/questions/9115018/regular-expression-using-ruby-string-gsub-method-to-replace-multi-matches
164
- if RUBY_VERSION >= "1.9"
165
- s /^\\item(?=((?!\\begin\{itemize\}).)*\\end\{itemize\})/m, '\\item[*]'
166
- else
167
- s /(^\\item)/m,'\item[*]'
168
- end
169
- end
170
-
171
- if chapter != true
172
- s /^\\chap\{(.*)\}/,'\chapter*{\1}'"\n"'\addcontentsline{toc}{chapter}{\1}'
173
- s /^\\section\{(.*)\}/,'\section*{\1}'
174
- s /^\\subsection\{(.*)\}/,'\subsection*{\1}'
175
- end
176
-
177
- end
178
- end
179
-
180
- #`
181
-
182
- $config = YAML.load_file(options[:config])
183
- template = ERB.new(File.read(options[:template]))
184
- languages = [options[:lang]]
185
- missing = ['pandoc', 'xelatex'].reject{|command| command_exists?(command)}
186
- unless missing.empty?
187
- puts "Missing dependencies: #{missing.join(', ')}."
188
- puts "Install these and try again."
189
- exit
190
- end
191
-
192
- figures do
193
- languages.each do |lang|
194
- config = $config['default'].merge($config[lang]) rescue $config['default']
195
-
196
- puts "#{lang}:"
197
- prefacemarkdown = Dir["#$root/#{lang}/0preface/*.markdown"].sort.map do |file|
198
- File.read(file)
199
- end.join("\n\n")
200
-
201
- print "\tParsing preface markdown... "
202
- preface = IO.popen('pandoc -p --no-wrap -f markdown -t latex', 'w+') do |pipe|
203
- pipe.write(pre_pandoc(prefacemarkdown, config))
204
- pipe.close_write
205
- post_pandoc(pipe.read, config, lang, false)
206
- end
207
-
208
- chaptersmarkdown = Dir["#$root/#{lang}/*chapters/*.markdown"].sort.map do |file|
209
- File.read(file)
210
- end.join("\n\n")
211
- puts "done"
212
-
213
- print "\tParsing main chapters markdown... "
214
- chapters = IO.popen('pandoc -p --no-wrap -f markdown -t latex', 'w+') do |pipe|
215
- pipe.write(pre_pandoc(chaptersmarkdown, config))
216
- pipe.close_write
217
- post_pandoc(pipe.read, config, lang)
218
- end
219
- puts "done"
220
-
221
- appendixmarkdown = Dir["#$root/#{lang}/*appendix/*.markdown"].sort.map do |file|
222
- File.read(file)
223
- end.join("\n\n")
224
-
225
- print "\tParsing appendix markdown... "
226
- appendix = IO.popen('pandoc -p --no-wrap -f markdown -t latex', 'w+') do |pipe|
227
- pipe.write(pre_pandoc(appendixmarkdown, config))
228
- pipe.close_write
229
- post_pandoc(pipe.read, config, lang)
230
- end
231
- puts "done"
232
-
233
- print "\tCreating main.tex for #{lang}... "
234
- dir = "#$here/#{lang}"
235
- mkdir_p(dir)
236
-
237
- File.open("#{dir}/main.tex", 'w') do |file|
238
- file.write(template.result(binding))
239
- end
240
- puts "done"
241
-
242
- abort = false
243
-
244
- puts "\tRunning XeTeX:"
245
- cd($root)
246
- 3.times do |i|
247
- print "\t\tPass #{i + 1}... "
248
- IO.popen("xelatex -output-directory=\"#{dir}\" \"#{dir}/main.tex\" 2>&1",'r:UTF-16LE:UTF-8') do |pipe|
249
- unless $DEBUG
250
- if ~ /^!\s/
251
- puts "failed with:\n\t\t\t#{$_.strip}"
252
- puts "\tConsider running this again with --debug."
253
- abort = true
254
- end while pipe.gets and not abort
255
- else
256
- STDERR.print while pipe.gets rescue abort = true
257
- end
258
- end
259
- break if abort
260
- puts "done"
261
- end
262
-
263
- unless abort
264
- print "\tMoving output to #{name}.#{lang}.pdf... "
265
- mv("#{dir}/main.pdf", "#$root/#{name}.#{lang}.pdf")
266
- puts "done"
267
- else
268
- print "\tConvert error, exit !\n"
269
- exit 1
270
- end
271
- end
272
- end
273
-
274
-
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'fileutils'
5
+ require 'erb'
6
+ require 'yaml'
7
+
8
+ include FileUtils
9
+
10
+ options = {
11
+ :build=> "pdf",
12
+ :lang => "zh",
13
+ :config => "latex/config.yml",
14
+ :template => "latex/template.tex"
15
+ }
16
+ CONFIG_FILE = File.join('.mkbok.yml')
17
+ if File.exists? CONFIG_FILE
18
+ config_options = YAML.load_file(CONFIG_FILE)
19
+ options.merge!(config_options)
20
+ end
21
+
22
+ option_parser = OptionParser.new do |opts|
23
+ executable_name = File.basename($PROGRAM_NAME)
24
+ opts.banner = "make ebooks from markdown plain text
25
+ Usage: #{executable_name} [options]
26
+ "
27
+ # Create a switch
28
+ opts.on("-b","--build FORMAT","build") do |format|
29
+ unless format=="pdf"
30
+ raise ArgumentError,"FORMAT must be in 'pdf' format"
31
+ end
32
+ options[:build] = format
33
+ end
34
+ opts.on("-d","--debug","debug") do
35
+ options[:debug] = true
36
+ end
37
+ # Create a flag
38
+ opts.on("-l","--lang LANG","language selection") do |lang|
39
+ unless lang=="zh" or lang=="en"
40
+ raise ArgumentError,"LANG must be in zh or en"
41
+ end
42
+ options[:lang] = lang
43
+ end
44
+ opts.on("-c","--config CONFIG","config file") do |config|
45
+ unless File.exists? config
46
+ raise ArgumentError,"config file \"#{config}\" doesn't exist"
47
+ end
48
+ options[:config] = config
49
+ end
50
+ opts.on("-t","--template template.tex","latex template file") do |template|
51
+ unless File.exists? template
52
+ raise ArgumentError,"template file \"#{template}\" doesn't exist"
53
+ end
54
+ options[:template] = template
55
+ end
56
+ opts.on("-n","--name book name","book name") do |name|
57
+ unless name =~ /^[a-zA-Z0-9]+$/
58
+ raise ArgumentError,"name should be [a-zA-Z0-9]"
59
+ end
60
+ options[:name] = name
61
+ end
62
+ end
63
+
64
+ option_parser.parse!
65
+
66
+ $here = File.expand_path(File.dirname(__FILE__))
67
+ $root = File.join($here)
68
+ $outDir = File.join($root, 'pdf')
69
+ options[:name] = File.basename(Dir.getwd) unless options[:name]
70
+
71
+ puts options.inspect if options[:debug]
72
+
73
+ def figures(&block)
74
+ begin
75
+ Dir["#$root/figures/18333*.png"].each do |file|
76
+ cp(file, file.sub(/18333fig0(\d)0?(\d+)\-tn/, '\1.\2'))
77
+ end
78
+ block.call
79
+ ensure
80
+ Dir["#$root/figures/18333*.png"].each do |file|
81
+ rm(file.gsub(/18333fig0(\d)0?(\d+)\-tn/, '\1.\2'))
82
+ end
83
+ end
84
+ end
85
+
86
+ def command_exists?(command)
87
+ if File.executable?(command) then
88
+ return command
89
+ end
90
+ ENV['PATH'].split(File::PATH_SEPARATOR).map do |path|
91
+ cmd = "#{path}/#{command}"
92
+ File.executable?(cmd) || File.executable?("#{cmd}.exe") || File.executable?("#{cmd}.cmd")
93
+ end.inject{|a, b| a || b}
94
+ end
95
+
96
+ def replace(string, &block)
97
+ string.instance_eval do
98
+ alias :s :gsub!
99
+ instance_eval(&block)
100
+ end
101
+ string
102
+ end
103
+
104
+ def verbatim_sanitize(string)
105
+ string.gsub('\\', '{\textbackslash}').
106
+ gsub('~', '{\textasciitilde}').
107
+ gsub(/([\$\#\_\^\%])/, '\\\\' + '\1{}')
108
+ end
109
+
110
+ def pre_pandoc(string, config)
111
+ replace(string) do
112
+ s /\#\#\#\#\# (.*?) \#\#\#\#\#/, 'PARASECTION: \1'
113
+ # Pandoc discards #### subsubsections #### - this hack recovers them
114
+ s /\#\#\#\# (.*?) \#\#\#\#/, 'SUBSUBSECTION: \1'
115
+
116
+ # Turns URLs into clickable links
117
+ s /\`(http:\/\/[A-Za-z0-9\/\%\&\=\-\_\\\.]+)\`/, '<\1>'
118
+ s /(\n\n)\t(http:\/\/[A-Za-z0-9\/\%\&\=\-\_\\\.]+)\n([^\t]|\t\n)/, '\1<\2>\1'
119
+
120
+ # Process figures
121
+ s /Insert\s18333fig\d+\.png\s*\n.*?\d{1,2}-\d{1,2}\. (.*)/, 'FIG: \1'
122
+ end
123
+ end
124
+
125
+ # `
126
+
127
+ def post_pandoc(string, config, lang, chapter=true)
128
+ replace(string) do
129
+ space = /\s/
130
+
131
+ # Reformat for the book documentclass as opposed to article
132
+ s '\section', '\chap'
133
+ s '\sub', '\\'
134
+ s /SUBSUBSECTION: (.*)/, '\subsubsection{\1}'
135
+ s /PARASECTION: (.*)/, '\paragraph{\1}'
136
+
137
+ # Enable proper cross-reference
138
+ s /#{config['fig'].gsub(space, '\s')}\s*(\d+)\-\-(\d+)/, '\imgref{\1.\2}'
139
+ s /#{config['tab'].gsub(space, '\s')}\s*(\d+)\-\-(\d+)/, '\tabref{\1.\2}'
140
+ s /#{config['prechap'].gsub(space, '\s')}\s*(\d+)(\s*)#{config['postchap'].gsub(space, '\s')}/, '\chapref{\1}\2'
141
+
142
+ # Miscellaneous fixes
143
+ s /FIG: (.*)/, '\img{\1}'
144
+ s '\begin{enumerate}[1.]', '\begin{enumerate}'
145
+ s /(\w)--(\w)/, '\1-\2'
146
+ s /``(.*?)''/, "#{config['dql']}\\1#{config['dqr']}"
147
+
148
+ # Typeset the maths in the book with TeX
149
+ s '\verb!p = (n(n-1)/2) * (1/2^160))!', '$p = \frac{n(n-1)}{2} \times \frac{1}{2^{160}}$)'
150
+ s '2\^{}80', '$2^{80}$'
151
+ s /\sx\s10\\\^\{\}(\d+)/, '\e{\1}'
152
+
153
+ # Convert inline-verbatims into \texttt (which is able to wrap)
154
+ s /\\verb(\W)(.*?)\1/ do
155
+ "{\\texttt{#{verbatim_sanitize($2)}}}"
156
+ end
157
+
158
+ # Ensure monospaced stuff is in a smaller font
159
+ s /(\\verb(\W).*?\2)/, '{\footnotesize\1}'
160
+ s /(\\begin\{verbatim\}.*?\\end\{verbatim\})/m, '{\footnotesize\1}'
161
+
162
+ # Shaded verbatim block
163
+ s /(\\begin\{verbatim\}.*?\\end\{verbatim\})/m, '\begin{shaded}\1\end{shaded}'
164
+
165
+ if lang=="zh"
166
+ # http://www.devdaily.com/blog/post/latex/control-line-spacing-in-itemize-enumerate-tags
167
+ # http://wiki.ctex.org/index.php/LaTeX/%E5%88%97%E8%A1%A8
168
+ # set the space of itemsize
169
+ s /(\\begin\{itemize\})/m,'\begin{itemize}\setlength{\itemsep}{1pt}\setlength{\parskip}{0pt}\setlength{\parsep}{0pt}'
170
+ s /(\\begin\{enumerate\})/m,'\begin{enumerate}\setlength{\itemsep}{1pt}\setlength{\parskip}{0pt}\setlength{\parsep}{0pt}'
171
+ # hardcode for itemize to use * instead of dot, which is missed in some chinese fonts
172
+ # and keep \item inside \enumerate env is not changed
173
+ # \item -> \item[*]
174
+ # solution is provided by Alexis, and it works under ruby 1.9+ only due to bug in 1.8.7
175
+ # http://stackoverflow.com/questions/9115018/regular-expression-using-ruby-string-gsub-method-to-replace-multi-matches
176
+ if RUBY_VERSION >= "1.9"
177
+ s /^\\item(?=((?!\\begin\{itemize\}).)*\\end\{itemize\})/m, '\\item[*]'
178
+ else
179
+ s /(^\\item)/m,'\item[*]'
180
+ end
181
+ end
182
+
183
+ if chapter != true
184
+ s /^\\chap\{(.*)\}/,'\chapter*{\1}'"\n"'\addcontentsline{toc}{chapter}{\1}'
185
+ s /^\\section\{(.*)\}/,'\section*{\1}'
186
+ s /^\\subsection\{(.*)\}/,'\subsection*{\1}'
187
+ end
188
+
189
+ end
190
+ end
191
+
192
+ $config = YAML.load_file(options[:config])
193
+ template = ERB.new(File.read(options[:template]))
194
+ languages = [options[:lang]]
195
+ missing = ['pandoc', 'xelatex'].reject{|command| command_exists?(command)}
196
+ unless missing.empty?
197
+ puts "Missing dependencies: #{missing.join(', ')}."
198
+ puts "Install these and try again."
199
+ exit
200
+ end
201
+
202
+ puts "Will generate pdf for the following languages:"
203
+ puts " #{languages}"
204
+ puts
205
+
206
+ figures do
207
+ languages.each do |lang|
208
+ config = $config['default'].merge($config[lang]) rescue $config['default']
209
+
210
+ puts "#{lang}:"
211
+ prefacemarkdown = Dir["#$root/#{lang}/0preface/*.markdown"].sort.map do |file|
212
+ File.read(file)
213
+ end.join("\n\n")
214
+
215
+ print "\tParsing preface markdown... "
216
+ preface = IO.popen('pandoc -p --no-wrap -f markdown -t latex', 'w+') do |pipe|
217
+ pipe.write(pre_pandoc(prefacemarkdown, config))
218
+ pipe.close_write
219
+ post_pandoc(pipe.read, config, lang, false)
220
+ end
221
+
222
+ chaptersmarkdown = Dir["#$root/#{lang}/*chapters/*.markdown"].sort.map do |file|
223
+ File.read(file)
224
+ end.join("\n\n")
225
+ puts "done"
226
+
227
+ print "\tParsing main chapters markdown... "
228
+ chapters = IO.popen('pandoc -p --no-wrap -f markdown -t latex', 'w+') do |pipe|
229
+ pipe.write(pre_pandoc(chaptersmarkdown, config))
230
+ pipe.close_write
231
+ post_pandoc(pipe.read, config, lang)
232
+ end
233
+ puts "done"
234
+
235
+ appendixmarkdown = Dir["#$root/#{lang}/*appendix/*.markdown"].sort.map do |file|
236
+ File.read(file)
237
+ end.join("\n\n")
238
+
239
+ print "\tParsing appendix markdown... "
240
+ appendix = IO.popen('pandoc -p --no-wrap -f markdown -t latex', 'w+') do |pipe|
241
+ pipe.write(pre_pandoc(appendixmarkdown, config))
242
+ pipe.close_write
243
+ post_pandoc(pipe.read, config, lang)
244
+ end
245
+ puts "done"
246
+
247
+ print "\tCreating main.tex for #{lang}... "
248
+ dir = "#$root/latex/#{lang}"
249
+ mkdir_p(dir)
250
+
251
+ File.open("#{dir}/main.tex", 'w') do |file|
252
+ file.write(template.result(binding))
253
+ end
254
+ puts "done"
255
+
256
+ abort = false
257
+
258
+ puts "\tRunning XeTeX:"
259
+ cd($root)
260
+ 3.times do |i|
261
+ print "\t\tPass #{i + 1}... "
262
+ IO.popen("xelatex -output-directory=\"#{dir}\" \"#{dir}/main.tex\" 2>&1",'r:UTF-16LE:UTF-8') do |pipe|
263
+ unless $DEBUG
264
+ if ~ /^!\s/
265
+ puts "failed with:\n\t\t\t#{$_.strip}"
266
+ puts "\tConsider running this again with --debug."
267
+ abort = true
268
+ end while pipe.gets and not abort
269
+ else
270
+ STDERR.print while pipe.gets rescue abort = true
271
+ end
272
+ end
273
+ break if abort
274
+ puts "done"
275
+ end
276
+
277
+ unless abort
278
+ print "\tMoving output to #{options[:name]}.#{lang}.pdf... "
279
+ mv("#{dir}/main.pdf", "#$root/#{options[:name]}.#{lang}.pdf")
280
+ puts "done"
281
+ else
282
+ print "\tConvert error, exit !\n"
283
+ exit 1
284
+ end
285
+ end
286
+ end
287
+
288
+
data/lib/mkbok_version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module MkBok
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
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.2
4
+ version: 0.0.3
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-09 00:00:00.000000000 Z
12
+ date: 2012-02-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: the ebook generate tools from markdown plain text
15
15
  email: