erbtex 0.4.3 → 0.4.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/erbtex/runner.rb +12 -2
- data/lib/erbtex/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5312a62db545e823d88b6f83fda0924a7b37e03aba65d5592b8da33045f9ba7e
|
4
|
+
data.tar.gz: b35033aa29360af46c7bb55c6cf730fa57654ccb9eb88566e6a0909c0d0f48a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dffa4203b424040ad13bb2bc5d123aae704d526d2a41b10390ad0d2c6c2ba171bcb87b06dbc16adda3361364aef3409029ff460a3c4eee75b3a15f32063ddc94
|
7
|
+
data.tar.gz: 6b5b3e7d105b7de8ad70a87206923e2272296c3907e62b4a30057dabcf503e02bac022863908d651ff462c7ea6e001338f2cf69996a5684e4bb69e391ec20b19
|
data/Gemfile.lock
CHANGED
data/lib/erbtex/runner.rb
CHANGED
@@ -57,7 +57,9 @@ module ErbTeX
|
|
57
57
|
def self.run_tex(cmd, in_dir = nil)
|
58
58
|
# If the input file is located in another directory (in_dir), add that
|
59
59
|
# directory to TEXINPUTS if its not already there so that the input file
|
60
|
-
# can \include or \input files using relative file names.
|
60
|
+
# can \include or \input files using relative file names. Place it after
|
61
|
+
# the current directory '.' so that an plain file name is still
|
62
|
+
# interpreted relative to the current working directory.
|
61
63
|
new_env = {}
|
62
64
|
if in_dir
|
63
65
|
in_dir = File.absolute_path(File.expand_path(in_dir))
|
@@ -65,17 +67,19 @@ module ErbTeX
|
|
65
67
|
unless ENV['TEXINPUTS'].split(File::PATH_SEPARATOR)
|
66
68
|
.reject { |p| p.strip.empty? }
|
67
69
|
.any? { |p| in_dir == File.absolute_path(File.expand_path(p)) }
|
68
|
-
new_env['TEXINPUTS'] = "
|
70
|
+
new_env['TEXINPUTS'] = ".:#{in_dir}:#{ENV['TEXINPUTS']}"
|
69
71
|
end
|
70
72
|
end
|
71
73
|
# Call cmd with the environment augmented by possibly expanded TEXINPUTS
|
72
74
|
# environment variable.
|
75
|
+
warn "TEXINPUTS set to: #{new_env['TEXINPUTS']}"
|
73
76
|
unless system(new_env, cmd)
|
74
77
|
warn "Call to '#{cmd}' failed."
|
75
78
|
exit $CHILD_STATUS
|
76
79
|
end
|
77
80
|
# Run a second time unless its latexmk
|
78
81
|
unless cmd =~ /\A *latexmk/
|
82
|
+
warn "TEXINPUTS set to: #{new_env['TEXINPUTS']}"
|
79
83
|
unless system(new_env, cmd)
|
80
84
|
warn "Call to '#{cmd}' failed."
|
81
85
|
exit $CHILD_STATUS
|
@@ -89,6 +93,8 @@ module ErbTeX
|
|
89
93
|
# the input file can be found if they are in the in_dir. Return the name of
|
90
94
|
# the output file.
|
91
95
|
def self.erb_to_tex(in_file, in_dir = nil)
|
96
|
+
warn '================================================================'
|
97
|
+
warn 'Erubis phase of processing ...'
|
92
98
|
# Add input to ruby LOAD_PATH, $:,if its not already there.
|
93
99
|
if File.exist?(in_dir)
|
94
100
|
in_dir = File.absolute_path(File.expand_path(in_dir))
|
@@ -99,6 +105,7 @@ module ErbTeX
|
|
99
105
|
end
|
100
106
|
|
101
107
|
# Read the input
|
108
|
+
warn " Erubis reading from #{in_file}..."
|
102
109
|
in_contents = nil
|
103
110
|
File.open(in_file) do |f|
|
104
111
|
in_contents = f.read
|
@@ -108,10 +115,13 @@ module ErbTeX
|
|
108
115
|
pat = ENV['ERBTEX_PATTERN'] || '{: :}'
|
109
116
|
|
110
117
|
out_file = ErbTeX.out_file_name(in_file)
|
118
|
+
warn " Erubis writing to #{out_file}..."
|
111
119
|
File.open(out_file, 'w') do |f|
|
112
120
|
er = ::Erubis::Eruby.new(in_contents, pattern: pat)
|
113
121
|
f.write(er.result)
|
114
122
|
end
|
123
|
+
warn 'done'
|
124
|
+
warn '================================================================'
|
115
125
|
out_file
|
116
126
|
rescue SystemCallError => e
|
117
127
|
warn "Error: #{e}"
|
data/lib/erbtex/version.rb
CHANGED