pandocomatic 0.1.0.b → 0.1.0.b.1
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/lib/pandocomatic/command/command.rb +4 -0
- data/lib/pandocomatic/command/convert_file_command.rb +16 -7
- data/lib/pandocomatic/pandocomatic.rb +2 -1
- data/lib/pandocomatic/printer/summary_printer.rb +4 -0
- data/lib/pandocomatic/printer/views/finish.txt +1 -1
- data/lib/pandocomatic/printer/views/summary.txt +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 217edd13fc750fb38bc89a581f4b3346d3209c78
|
4
|
+
data.tar.gz: ed4279ad947ba95dea74869ddac804637c07eb53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 695974f4b25f9ca78b193ef07c663c313f8665ff4e20e6c57e3dc308b396c67d14cb6496665d10a923421a36132dfc200e766347259d0907004223466deee0d2
|
7
|
+
data.tar.gz: 1938a93c3ea57ac415af2baeebf6a1b759e653b8e56feb929369e1d726b786b17407ec0e57648b06256bae60110d57b636923a8009e54b17d8bdda03c3b648a5
|
@@ -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
|
-
|
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
|
-
|
73
|
+
template = @config.get_template template_name
|
70
74
|
|
71
|
-
|
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
|
-
|
117
|
-
|
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
|
@@ -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 %>.
|