docfu 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.
- data/lib/docfu.rb +1 -1
- data/lib/docfu/outputs/pdf.rb +8 -2
- metadata +2 -2
data/lib/docfu.rb
CHANGED
data/lib/docfu/outputs/pdf.rb
CHANGED
@@ -5,6 +5,7 @@ require 'base'
|
|
5
5
|
module Docfu
|
6
6
|
class Pdf < BaseOutput
|
7
7
|
def generate(languages, debug)
|
8
|
+
create_output_dir unless File.exists? output_dir
|
8
9
|
figures do
|
9
10
|
languages.each do |lang|
|
10
11
|
cfg = config['default'].merge(config[lang]) rescue config['default']
|
@@ -37,7 +38,7 @@ module Docfu
|
|
37
38
|
cd(project_home)
|
38
39
|
3.times do |i|
|
39
40
|
print " Pass #{i + 1}... "
|
40
|
-
IO.popen("xelatex -output-directory=\"#{
|
41
|
+
IO.popen("xelatex -output-directory=\"#{output_dir}\" \"#{dir}/main.tex\" 2>&1") do |pipe|
|
41
42
|
unless debug
|
42
43
|
if ~ /^!\s/
|
43
44
|
puts "failed with:\n #{$_.strip}"
|
@@ -54,7 +55,8 @@ module Docfu
|
|
54
55
|
|
55
56
|
unless abort
|
56
57
|
print " Moving output to #{info['title'].split(' ').join('_')}.#{lang}.pdf... "
|
57
|
-
|
58
|
+
["aux", "log", "out", "toc"].each { |f| rm "#{output_dir}/main.#{f}" }
|
59
|
+
mv("#{output_dir}/main.pdf", "#{output_dir}/#{info['title'].split(' ').join('_')}.#{lang}.pdf")
|
58
60
|
puts "done"
|
59
61
|
end
|
60
62
|
end
|
@@ -69,6 +71,10 @@ module Docfu
|
|
69
71
|
"#{project_home}/pdf"
|
70
72
|
end
|
71
73
|
|
74
|
+
def create_output_dir
|
75
|
+
FileUtils.mkdir_p(output_dir)
|
76
|
+
end
|
77
|
+
|
72
78
|
def tex_template
|
73
79
|
"#{Docfu::Skeleton.templates_location}/book.tex"
|
74
80
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docfu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
segments:
|
174
174
|
- 0
|
175
|
-
hash:
|
175
|
+
hash: -67242471902472211
|
176
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
177
|
none: false
|
178
178
|
requirements:
|