pandocomatic 0.1.0.b → 0.1.0.b.1

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: dffe0869e5d1d21dea4701c4a102be0965a5fb38
4
- data.tar.gz: f0c876b6f2833288b1c70d02e64c65efee067985
3
+ metadata.gz: 217edd13fc750fb38bc89a581f4b3346d3209c78
4
+ data.tar.gz: ed4279ad947ba95dea74869ddac804637c07eb53
5
5
  SHA512:
6
- metadata.gz: 13a606257cc004eb37f775f24aa561459e0d44adf4657ea0b28dcd7c5e4991a4d7bd5f34f985eca94eef1c972e1800f53be2cf54f8b65247c4edbd5a3e072ca2
7
- data.tar.gz: 0c8bb7e39e23858b4a123a5e213005aaed34e63ff42fd213c8c55f54a1cb3583cba51f6eded036012a989dfca15e0b379c524da8dbfb926798aa534b4659ddc5
6
+ metadata.gz: 695974f4b25f9ca78b193ef07c663c313f8665ff4e20e6c57e3dc308b396c67d14cb6496665d10a923421a36132dfc200e766347259d0907004223466deee0d2
7
+ data.tar.gz: 1938a93c3ea57ac415af2baeebf6a1b759e653b8e56feb929369e1d726b786b17407ec0e57648b06256bae60110d57b636923a8009e54b17d8bdda03c3b648a5
@@ -68,6 +68,10 @@ module Pandocomatic
68
68
  @errors
69
69
  end
70
70
 
71
+ def make_quiet()
72
+ @@quiet = true
73
+ end
74
+
71
75
  def index_to_s()
72
76
  "#{@@total - @index + 1}".rjust(@@total.to_s.size)
73
77
  end
@@ -50,7 +50,7 @@ module Pandocomatic
50
50
  end
51
51
 
52
52
  def to_s
53
- "convert #{File.basename @src} -> #{File.basename @dst}"
53
+ "convert #{File.basename @src} #{"-> #{File.basename @dst}" unless @dst.nil?}"
54
54
  end
55
55
 
56
56
  private
@@ -58,17 +58,22 @@ module Pandocomatic
58
58
  def convert_file
59
59
  metadata = PandocMetadata.load_file @src
60
60
 
61
+ pandoc_options = metadata.pandoc_options || {}
62
+ template = {}
63
+
61
64
  if metadata.has_template? then
62
65
  template_name = metadata.template_name
63
66
  else
64
67
  template_name = @config.determine_template @src
65
68
  end
66
69
 
67
- raise ConfigurationError.new(:no_such_template, nil, template_name) unless @config.has_template? template_name
70
+ if not template_name.nil? and not template_name.empty?
71
+ raise ConfigurationError.new(:no_such_template, nil, template_name) unless @config.has_template? template_name
68
72
 
69
- template = @config.get_template template_name
73
+ template = @config.get_template template_name
70
74
 
71
- pandoc_options = (template['pandoc'] || {}).merge(metadata.pandoc_options || {})
75
+ pandoc_options = (template['pandoc'] || {}).merge(pandoc_options)
76
+ end
72
77
 
73
78
  input = File.read @src
74
79
  input = FileInfoPreprocessor.run input, @src
@@ -112,9 +117,13 @@ module Pandocomatic
112
117
  def pandoc(input, options, src_dir)
113
118
  converter = Paru::Pandoc.new
114
119
  options.each do |option, value|
115
-
116
- value = @config.update_path value, src_dir if
117
- PANDOC_OPTIONS_WITH_PATH.include? option
120
+ if PANDOC_OPTIONS_WITH_PATH.include? option
121
+ if value.is_a? Array
122
+ value = value.map {|v| @config.update_path v, src_dir}
123
+ else
124
+ value = @config.update_path value, src_dir
125
+ end
126
+ end
118
127
 
119
128
  converter.send option, value unless option == 'output'
120
129
  # don't let pandoc write the output to enable postprocessing
@@ -80,6 +80,7 @@ module Pandocomatic
80
80
  command = ConvertDirCommand.new(configuration, input, output)
81
81
  else
82
82
  command = ConvertFileCommand.new(configuration, input, output)
83
+ command.make_quiet
83
84
  end
84
85
 
85
86
  # Notify the user about all configuration errors collected when
@@ -92,7 +93,7 @@ module Pandocomatic
92
93
 
93
94
  # Pandocomatic is successfully configured: running the
94
95
  # actual conversion now.
95
- SummaryPrinter.new(command, input, output).print unless quiet
96
+ SummaryPrinter.new(command, input, output).print unless quiet or not command.directory?
96
97
 
97
98
  # Depending on the options dry-run and quiet, the command.execute
98
99
  # method will actually performing the commands (dry-run = false) and
@@ -31,5 +31,9 @@ module Pandocomatic
31
31
  "#{@command.count} command#{'s' if @command.count != 1}"
32
32
  end
33
33
 
34
+ def has_output?()
35
+ not @output.nil? and not @output.empty?
36
+ end
37
+
34
38
  end
35
39
  end
@@ -1 +1 @@
1
- Pandocomatic needed <%=duration%> to convert '<%= @input %>' to '<%= @output %>'.
1
+ Pandocomatic needed <%=duration%> to convert '<%= @input %>'<%if has_output?%> to '<%= @output %>'<%end%>.
@@ -1 +1 @@
1
- <% if @command.count <= 0 then%>Nothing to do<% else %><%= commands %> to execute to convert '<%= @input %>' to '<%= @output %>'<% end %>.
1
+ <% if @command.count <= 0 then%>Nothing to do<% else %><%= commands %> to execute to convert '<%= @input %>'<%if has_output?%> to '<%= @output %>'<%end%><% end %>.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandocomatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.b
4
+ version: 0.1.0.b.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Huub de Beer