mkbok 0.0.3 → 0.0.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/bin/mkbok +22 -12
- data/lib/mkbok_version.rb +1 -1
- metadata +1 -1
data/bin/mkbok
CHANGED
@@ -63,7 +63,8 @@ end
|
|
63
63
|
|
64
64
|
option_parser.parse!
|
65
65
|
|
66
|
-
|
66
|
+
#$here = File.expand_path(File.dirname(__FILE__))
|
67
|
+
$here = Dir.getwd
|
67
68
|
$root = File.join($here)
|
68
69
|
$outDir = File.join($root, 'pdf')
|
69
70
|
options[:name] = File.basename(Dir.getwd) unless options[:name]
|
@@ -199,7 +200,7 @@ unless missing.empty?
|
|
199
200
|
exit
|
200
201
|
end
|
201
202
|
|
202
|
-
puts "Will generate pdf for the following languages:"
|
203
|
+
puts "Will generate pdf for the following languages using template #{options[:template]}:"
|
203
204
|
puts " #{languages}"
|
204
205
|
puts
|
205
206
|
|
@@ -208,44 +209,53 @@ figures do
|
|
208
209
|
config = $config['default'].merge($config[lang]) rescue $config['default']
|
209
210
|
|
210
211
|
puts "#{lang}:"
|
211
|
-
|
212
|
+
puts "\tParsing preface markdown... "
|
213
|
+
prefacemarkdown = Dir["#$root/#{lang}/*preface/*.markdown"].sort.map do |file|
|
214
|
+
puts "\t =>"+file
|
212
215
|
File.read(file)
|
213
216
|
end.join("\n\n")
|
214
217
|
|
215
|
-
print "\tParsing preface markdown... "
|
216
218
|
preface = IO.popen('pandoc -p --no-wrap -f markdown -t latex', 'w+') do |pipe|
|
217
219
|
pipe.write(pre_pandoc(prefacemarkdown, config))
|
218
220
|
pipe.close_write
|
219
221
|
post_pandoc(pipe.read, config, lang, false)
|
220
222
|
end
|
221
223
|
|
224
|
+
puts "\n\tParsing main chapters markdown... "
|
225
|
+
found = false
|
222
226
|
chaptersmarkdown = Dir["#$root/#{lang}/*chapters/*.markdown"].sort.map do |file|
|
227
|
+
found = true
|
228
|
+
puts "\t =>"+file
|
223
229
|
File.read(file)
|
224
230
|
end.join("\n\n")
|
225
|
-
|
231
|
+
chaptersmarkdown = Dir["#$root/#{lang}/*/*.markdown"].sort.map do |file|
|
232
|
+
puts "\t =>"+file
|
233
|
+
File.read(file)
|
234
|
+
end.join("\n\n") unless found
|
235
|
+
# puts "done"
|
226
236
|
|
227
|
-
|
228
|
-
chapters = IO.popen('pandoc -p --no-wrap -f markdown -t latex', 'w+') do |pipe|
|
237
|
+
latex = IO.popen('pandoc -p --no-wrap -f markdown -t latex', 'w+') do |pipe|
|
229
238
|
pipe.write(pre_pandoc(chaptersmarkdown, config))
|
230
239
|
pipe.close_write
|
231
240
|
post_pandoc(pipe.read, config, lang)
|
232
241
|
end
|
233
|
-
puts "done"
|
242
|
+
# puts "done"
|
234
243
|
|
244
|
+
puts "\n\tParsing appendix markdown... "
|
235
245
|
appendixmarkdown = Dir["#$root/#{lang}/*appendix/*.markdown"].sort.map do |file|
|
246
|
+
puts "\t =>"+file
|
236
247
|
File.read(file)
|
237
248
|
end.join("\n\n")
|
238
249
|
|
239
|
-
print "\tParsing appendix markdown... "
|
240
250
|
appendix = IO.popen('pandoc -p --no-wrap -f markdown -t latex', 'w+') do |pipe|
|
241
251
|
pipe.write(pre_pandoc(appendixmarkdown, config))
|
242
252
|
pipe.close_write
|
243
253
|
post_pandoc(pipe.read, config, lang)
|
244
254
|
end
|
245
|
-
puts "done"
|
255
|
+
#puts "done"
|
246
256
|
|
247
|
-
print "\tCreating main.tex for #{lang}... "
|
248
|
-
dir = "
|
257
|
+
print "\n\tCreating main.tex for #{lang}... "
|
258
|
+
dir = "latex/#{lang}"
|
249
259
|
mkdir_p(dir)
|
250
260
|
|
251
261
|
File.open("#{dir}/main.tex", 'w') do |file|
|
data/lib/mkbok_version.rb
CHANGED