rb_latex 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/lib/rb_latex/maker.rb +11 -8
- data/lib/rb_latex/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0b9a42b31411e59612673356412e6f753f6d8786a0218a144473718e3f49d5f
|
4
|
+
data.tar.gz: 271eb929d4d760929d7b4a42ff122022c57dcf91a262669f50dfb9836b9adf86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55275c961565f9baf3b50299c59fa2f372ff51424a7868bff72797e60df37d14ea779582664d8836154ef81d98db34cc599c8f81955b835d37804fe6a50d9bfb
|
7
|
+
data.tar.gz: 48dfbb3ed6f6be6a48ea1fd486177e64cca9a13ebe5b20220e99c01391af7733777de3a728777b8c06559fbc775a8c33a00cd19484c84310a0c6eba913194bdc
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Masayoshi Takahashi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/lib/rb_latex/maker.rb
CHANGED
@@ -52,8 +52,7 @@ module RbLatex
|
|
52
52
|
copy_files(dir)
|
53
53
|
Dir.chdir(dir) do
|
54
54
|
generate_src(dir)
|
55
|
-
|
56
|
-
exec_dvipdf(dir)
|
55
|
+
compile_latex(dir)
|
57
56
|
end
|
58
57
|
FileUtils.cp(File.join(dir, "book.pdf"), filename)
|
59
58
|
end
|
@@ -61,7 +60,7 @@ module RbLatex
|
|
61
60
|
|
62
61
|
def copy_files(dir)
|
63
62
|
Dir.entries(@root_dir).each do |path|
|
64
|
-
next if path == "." or path == ".." or path
|
63
|
+
next if path == "." or path == ".." or path == @work_dir
|
65
64
|
FileUtils.cp_r(File.join(@root_dir, path), dir, dereference_root: true)
|
66
65
|
end
|
67
66
|
end
|
@@ -78,8 +77,9 @@ module RbLatex
|
|
78
77
|
File.write(File.join(dir, "rblatexdefault.sty"), rblatexdefault_sty)
|
79
78
|
end
|
80
79
|
|
81
|
-
def
|
82
|
-
|
80
|
+
def compile_latex(dir)
|
81
|
+
texfile = "book.tex"
|
82
|
+
cmd = "#{@latex_command} #{texfile}"
|
83
83
|
3.times do |i|
|
84
84
|
out, status = Open3.capture2e(cmd)
|
85
85
|
if !status.success?
|
@@ -90,11 +90,14 @@ module RbLatex
|
|
90
90
|
raise RbLatex::Error, "fail to exec latex (#{i}): #{cmd}"
|
91
91
|
end
|
92
92
|
end
|
93
|
+
dvifile = File.basename(texfile, ".*") + ".dvi"
|
94
|
+
if File.exist?(dvifile)
|
95
|
+
exec_dvipdf(dvifile)
|
96
|
+
end
|
93
97
|
end
|
94
98
|
|
95
|
-
def exec_dvipdf(
|
96
|
-
|
97
|
-
cmd = "#{@dvipdf_command} book.dvi"
|
99
|
+
def exec_dvipdf(dvifile)
|
100
|
+
cmd = "#{@dvipdf_command} #{dvifile}"
|
98
101
|
out, status = Open3.capture2e(cmd)
|
99
102
|
if !status.success?
|
100
103
|
@error_log = out
|
data/lib/rb_latex/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rb_latex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- takahashim
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- ".gitignore"
|
91
91
|
- ".travis.yml"
|
92
92
|
- Gemfile
|
93
|
+
- LICENSE
|
93
94
|
- README.md
|
94
95
|
- Rakefile
|
95
96
|
- bin/console
|