pandocomatic 0.2.0.3 → 0.2.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d2709f2c2749f23899e6f950673b58fe1982dd0
4
- data.tar.gz: e0a943a880a4403d6a1435867e0cf2e46e6595bd
3
+ metadata.gz: 06b67210be313024966c5d920e3724d1b9c42823
4
+ data.tar.gz: 8eca739a203e3f6c308db791120a2faef89824d2
5
5
  SHA512:
6
- metadata.gz: 20b21cf6c12f8e770b25eb8e8a124910c8d0fbfe530b9d1294982984b6e88f40fc6526fe4779fa4dbd0c6c9650b297c3480eb628f69e78749f794eda2b390213
7
- data.tar.gz: ac6eede225266eb2f60da753b26bbec7fb4a70b56df9cbda1e0169171381bf7f2d32d92501b39cb5c4e53dca02eefe748fb7561c58b9e01047939492728804ce
6
+ metadata.gz: d28bc6c7169d2c99020ff4d054b4d79cf76b8128d8b0c86831174ec1fdc529b386459543c69f654b95a143d0dfcdff96210d7e7ef25b4c7dbacba6edb959d600
7
+ data.tar.gz: da1cb13eb9ef9b2b2590032f3847cd166ee2cb5b0ed73e5e45856eda54cdc1f61c540bfaec958d249c226ebfe13a0b216f0a7d965f1621a7ff0edae2631adc6d
@@ -178,39 +178,42 @@ module Pandocomatic
178
178
  ]
179
179
 
180
180
  def pandoc(input, options, src_dir)
181
- converter = Paru::Pandoc.new
182
- options.each do |option, value|
183
- if PANDOC_OPTIONS_WITH_PATH.include? option
184
- is_executable = option == "filter"
185
- if value.is_a? Array
186
- value = value.map {|v| @config.update_path(v, src_dir, is_executable)}
187
- else
188
- value = @config.update_path(value, src_dir, is_executable)
181
+ absolute_dst = File.expand_path @dst
182
+ Dir.chdir(src_dir) do
183
+ converter = Paru::Pandoc.new
184
+ options.each do |option, value|
185
+ if PANDOC_OPTIONS_WITH_PATH.include? option
186
+ is_executable = option == "filter"
187
+ if value.is_a? Array
188
+ value = value.map {|v| @config.update_path(v, src_dir, is_executable)}
189
+ else
190
+ value = @config.update_path(value, src_dir, is_executable)
191
+ end
189
192
  end
190
- end
191
-
192
- # There is no "pdf" output format; change it to latex but keep the
193
- # extension.
194
- value = determine_output_for_pdf(options) if option == "to" and value == "pdf"
195
193
 
196
- begin
197
- # Pandoc multi-word options can have the multiple words separated by
198
- # both underscore (_) and dash (-).
199
- option = option.gsub "-", "_"
200
- converter.send option, value unless option == 'output'
201
- # don't let pandoc write the output to enable postprocessing
202
- rescue
203
- warn "The pandoc option '#{option}' (with value '#{value}') is not recognized by paru. This option is skipped." if debug?
194
+ # There is no "pdf" output format; change it to latex but keep the
195
+ # extension.
196
+ value = determine_output_for_pdf(options) if option == "to" and value == "pdf"
197
+
198
+ begin
199
+ # Pandoc multi-word options can have the multiple words separated by
200
+ # both underscore (_) and dash (-).
201
+ option = option.gsub "-", "_"
202
+ converter.send option, value unless option == 'output'
203
+ # don't let pandoc write the output to enable postprocessing
204
+ rescue
205
+ warn "The pandoc option '#{option}' (with value '#{value}') is not recognized by paru. This option is skipped." if debug?
206
+ end
204
207
  end
205
- end
206
208
 
207
- converter.send "output", @dst if OUTPUT_FORMATS.include? options["to"]
209
+ converter.send "output", absolute_dst if OUTPUT_FORMATS.include? options["to"]
208
210
 
209
- begin
210
- puts converter.to_command if debug?
211
- converter << input
212
- rescue Paru::Error => e
213
- raise PandocError.new(:error_running_pandoc, e, input)
211
+ begin
212
+ puts converter.to_command if debug?
213
+ converter << input
214
+ rescue Paru::Error => e
215
+ raise PandocError.new(:error_running_pandoc, e, input)
216
+ end
214
217
  end
215
218
  end
216
219
 
@@ -264,7 +267,6 @@ module Pandocomatic
264
267
 
265
268
  private
266
269
 
267
-
268
270
  # Pandoc version 2 supports multiple pdf engines. Determine which
269
271
  # to use given the options.
270
272
  #
@@ -260,12 +260,13 @@ module Pandocomatic
260
260
  # verified to be executable? Defaults to false.
261
261
  #
262
262
  # @return [String] the updated path.
263
- def update_path(path, src_dir, check_executable = false)
263
+ def update_path(path, src_dir, check_executable = false, output = false)
264
264
  updated_path = path
265
265
  if path.start_with? './'
266
266
  # refers to a local dir; strip the './' before appending it to
267
267
  # the source directory as to prevent /some/path/./to/path
268
- updated_path = File.join src_dir, path[2..-1]
268
+ #updated_path = File.join src_dir, path[2..-1]
269
+ updated_path = path[2..-1]
269
270
  else
270
271
  if path.start_with? '/'
271
272
  updated_path = path
@@ -50,7 +50,7 @@ module Pandocomatic
50
50
  ERROR_STATUS = 1266 # This is the sum of the ascii values of the characters in 'pandocomatic'
51
51
 
52
52
  # Pandocomatic's current version
53
- VERSION = [0, 2, 0, 3]
53
+ VERSION = [0, 2, 0, 4]
54
54
 
55
55
  # Pandocomatic's default configuration file
56
56
  CONFIG_FILE = 'pandocomatic.yaml'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandocomatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.3
4
+ version: 0.2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Huub de Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-22 00:00:00.000000000 Z
11
+ date: 2017-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paru
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 0.2.5
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.2.5.11
22
+ version: 0.2.5.12
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 0.2.5
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.2.5.11
32
+ version: 0.2.5.12
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: trollop
35
35
  requirement: !ruby/object:Gem::Requirement