pandocomatic 1.1.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pandocomatic/cli.rb +2 -2
  3. data/lib/pandocomatic/command/convert_file_command.rb +7 -7
  4. data/lib/pandocomatic/configuration.rb +12 -12
  5. data/lib/pandocomatic/error/cli_error.rb +1 -1
  6. data/lib/pandocomatic/error/configuration_error.rb +2 -2
  7. data/lib/pandocomatic/error/io_error.rb +1 -1
  8. data/lib/pandocomatic/error/pandoc_error.rb +1 -1
  9. data/lib/pandocomatic/error/pandoc_metadata_error.rb +34 -0
  10. data/lib/pandocomatic/error/pandocomatic_error.rb +1 -1
  11. data/lib/pandocomatic/error/processor_error.rb +1 -1
  12. data/lib/pandocomatic/error/template_error.rb +4 -4
  13. data/lib/pandocomatic/input.rb +1 -1
  14. data/lib/pandocomatic/multiple_files_input.rb +5 -5
  15. data/lib/pandocomatic/pandoc_metadata.rb +43 -11
  16. data/lib/pandocomatic/pandocomatic.rb +15 -16
  17. data/lib/pandocomatic/pandocomatic_yaml.rb +4 -4
  18. data/lib/pandocomatic/path.rb +2 -2
  19. data/lib/pandocomatic/printer/command_printer.rb +1 -1
  20. data/lib/pandocomatic/printer/configuration_errors_printer.rb +1 -1
  21. data/lib/pandocomatic/printer/error_printer.rb +2 -2
  22. data/lib/pandocomatic/printer/finish_printer.rb +1 -1
  23. data/lib/pandocomatic/printer/help_printer.rb +1 -1
  24. data/lib/pandocomatic/printer/printer.rb +1 -1
  25. data/lib/pandocomatic/printer/summary_printer.rb +1 -1
  26. data/lib/pandocomatic/printer/version_printer.rb +1 -1
  27. data/lib/pandocomatic/printer/views/pandoc_metadata_error.txt +4 -0
  28. data/lib/pandocomatic/printer/views/version.txt +1 -1
  29. data/lib/pandocomatic/printer/warning_printer.rb +2 -2
  30. data/lib/pandocomatic/{output.rb → version.rb} +3 -8
  31. metadata +54 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d9dc25a92269e65a3393c9de2ceb05ef87296193814097a1de93af3271d9772
4
- data.tar.gz: 5fa23415ec5f1f03c3113f781d548f716286129d30c8127e420767c56cbefb6d
3
+ metadata.gz: 4f39376e3d96e55e5790686b71fdefd805f5123b8f84d27ed478f0afd0f7bd7c
4
+ data.tar.gz: d283a68c6369d2435d1d11412a3ae7ada3da929ead2e222a56a0adc5a52869a0
5
5
  SHA512:
6
- metadata.gz: 236bc2c1109ef155530725b3b4895e5705328154c539068d6644168c8fbee3e99a7d9f1c7f39c20eacedd9727010fd5832d92f736b3d91e9b79895bad35173ce
7
- data.tar.gz: c604d7aefe76682d6e76c3d177c0310b72148fdb10d93874ef792e84625cae98ce1adda4ee9f68b68c6162138a56ed6f73c57774a7c51471d3f442177c35c272
6
+ metadata.gz: f8302476ee6b1296ebe2cd3714942487806c690290df7c64192d0154021f2b1669d030c3f116ce5e737c1faeebe833195fcdbbbc55eab53430fe5e7bf1ce843e
7
+ data.tar.gz: 17831ada9031d4376b01795f259f496476c2ba7beff6c6b26e5266fe8f30fd219ff3f94225dc0e57600fcbbaf0d1b21ef650e02c53b176d370ea81d736866e5e
@@ -21,8 +21,8 @@
21
21
  module Pandocomatic
22
22
  require 'optimist'
23
23
 
24
- require_relative './error/cli_error'
25
- require_relative './configuration'
24
+ require_relative 'error/cli_error'
25
+ require_relative 'configuration'
26
26
 
27
27
  ##
28
28
  # Command line options parser for pandocomatic using optimist.
@@ -120,9 +120,9 @@ module Pandocomatic
120
120
  def to_s
121
121
  str = "convert #{File.basename @src} #{"-> #{File.basename @dst}" unless @dst.nil?}"
122
122
  unless @metadata.unique?
123
- str += "\n\t encountered multiple YAML metadata blocks with a pandocomatic property."\
124
- ' Only the pandocomatic property in the first YAML metadata block is being used;'\
125
- ' the others are discarded.'
123
+ str += "\n\t encountered multiple YAML metadata blocks with a pandocomatic property. " \
124
+ 'Only the pandocomatic property in the first YAML metadata block is being used; ' \
125
+ 'the others are discarded.'
126
126
  end
127
127
  str
128
128
  end
@@ -152,8 +152,8 @@ module Pandocomatic
152
152
  # Ignore the `--verbose` option, and warn about ignoring it
153
153
  if pandoc_options.key? 'verbose'
154
154
  pandoc_options.delete 'verbose'
155
- warn 'WARNING: Ignoring the pandoc option --verbose because it'\
156
- ' might interfere with the working of pandocomatic.'
155
+ warn 'WARNING: Ignoring the pandoc option --verbose because it ' \
156
+ 'might interfere with the working of pandocomatic.'
157
157
  end
158
158
 
159
159
  template.merge! Template.new(INTERNAL_TEMPLATE, @metadata.pandocomatic) if @metadata.pandocomatic?
@@ -236,8 +236,8 @@ module Pandocomatic
236
236
  # don't let pandoc write the output to enable postprocessing
237
237
  rescue StandardError
238
238
  if debug?
239
- warn "WARNING: The pandoc option '#{option}' (with value '#{value}')"\
240
- ' is not recognized by paru. This option is skipped.'
239
+ warn "WARNING: The pandoc option '#{option}' (with value '#{value}') " \
240
+ 'is not recognized by paru. This option is skipped.'
241
241
  end
242
242
  end
243
243
  end
@@ -21,13 +21,13 @@
21
21
  module Pandocomatic
22
22
  require 'paru/pandoc'
23
23
 
24
- require_relative './error/configuration_error'
25
- require_relative './command/command'
26
- require_relative './input'
27
- require_relative './multiple_files_input'
28
- require_relative './pandocomatic_yaml'
29
- require_relative './path'
30
- require_relative './template'
24
+ require_relative 'error/configuration_error'
25
+ require_relative 'command/command'
26
+ require_relative 'input'
27
+ require_relative 'multiple_files_input'
28
+ require_relative 'pandocomatic_yaml'
29
+ require_relative 'path'
30
+ require_relative 'template'
31
31
 
32
32
  # The default configuration for pandocomatic is read from
33
33
  # default_configuration.yaml.
@@ -310,7 +310,7 @@ module Pandocomatic
310
310
  #
311
311
  # @return [String]
312
312
  def src_root
313
- @input.nil? ? nil : @input.absolute_path
313
+ @input&.absolute_path
314
314
  end
315
315
 
316
316
  # Have input CLI options be given?
@@ -607,8 +607,8 @@ module Pandocomatic
607
607
  if template.internal?
608
608
  warn "WARNING: Unable to find templates [#{missing.join(', ')}] while resolving internal template."
609
609
  else
610
- warn "WARNING: Unable to find templates [#{missing.join(', ')}] while resolving"\
611
- " the external template '#{template.name}' from configuration file '#{template.path}'."
610
+ warn "WARNING: Unable to find templates [#{missing.join(', ')}] while resolving " \
611
+ "the external template '#{template.name}' from configuration file '#{template.path}'."
612
612
  end
613
613
  end
614
614
 
@@ -658,8 +658,8 @@ module Pandocomatic
658
658
  if !renamed_dst.nil? && !renamed_dst.empty?
659
659
  renamed_dst.strip
660
660
  else
661
- raise StandardError, new("Running rename script '#{script}' on destination '#{dst}'"\
662
- ' did not result in a renamed destination.')
661
+ raise StandardError, new("Running rename script '#{script}' on destination '#{dst}' " \
662
+ 'did not result in a renamed destination.')
663
663
  end
664
664
  rescue StandardError => e
665
665
  ProcessorError.new(:error_processing_script, e, [script, dst])
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './pandocomatic_error'
22
+ require_relative 'pandocomatic_error'
23
23
 
24
24
  # A command-line error.
25
25
  class CLIError < PandocomaticError
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # Copyright 2017, Huub de Beer <Huub@heerdebeer.org>
4
+ # Copyright 2017 Huub de Beer <Huub@heerdebeer.org>
5
5
  #
6
6
  # This file is part of pandocomatic.
7
7
  #
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './pandocomatic_error'
22
+ require_relative 'pandocomatic_error'
23
23
 
24
24
  # A ConfigurationError
25
25
  class ConfigurationError < PandocomaticError
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './pandocomatic_error'
22
+ require_relative 'pandocomatic_error'
23
23
 
24
24
  # An IOError
25
25
  class IOError < PandocomaticError
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './pandocomatic_error'
22
+ require_relative 'pandocomatic_error'
23
23
 
24
24
  # An error when running pandoc
25
25
  class PandocError < PandocomaticError
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ #--
4
+ # Copyright 2023 Huub de Beer <Huub@heerdebeer.org>
5
+ #
6
+ # This file is part of pandocomatic.
7
+ #
8
+ # Pandocomatic is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by the
10
+ # Free Software Foundation, either version 3 of the License, or (at your
11
+ # option) any later version.
12
+ #
13
+ # Pandocomatic is distributed in the hope that it will be useful, but
14
+ # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
+ # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16
+ # for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License along
19
+ # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
+ #++
21
+ module Pandocomatic
22
+ require_relative 'pandocomatic_error'
23
+
24
+ # A PandocMetadataError
25
+ class PandocMetadataError < PandocomaticError
26
+ # The template to print this ConfigurationError
27
+ def template
28
+ 'pandoc_metadata_error.txt'
29
+ end
30
+
31
+ # :file_contains_horizontal_lines_with_three_dashes
32
+ # :cannot_parse_YAML_metadata
33
+ end
34
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # Copyright 2017, Huub de Beer <Huub@heerdebeer.org>
4
+ # Copyright 2017 Huub de Beer <Huub@heerdebeer.org>
5
5
  #
6
6
  # This file is part of pandocomatic.
7
7
  #
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './pandocomatic_error'
22
+ require_relative 'pandocomatic_error'
23
23
 
24
24
  # An error while running a processor
25
25
  class ProcessorError < PandocomaticError
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './pandocomatic_error'
22
+ require_relative 'pandocomatic_error'
23
23
 
24
24
  # A TemplateError
25
25
  class TemplateError < PandocomaticError
@@ -35,9 +35,9 @@ module Pandocomatic
35
35
  # Represent this template error as a string.
36
36
  # @return [String]
37
37
  def to_s
38
- "Environment variable '#{@data[:key]}'"\
39
- "#{" in '#{@data[:path]}'" unless @data[:path].nil?}"\
40
- ' does not exist: No substitution possible.'
38
+ "Environment variable '#{@data[:key]}'" \
39
+ "#{" in '#{@data[:path]}'" unless @data[:path].nil?} " \
40
+ 'does not exist: No substitution possible.'
41
41
  end
42
42
 
43
43
  # The template to print this TemplateError
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './configuration'
22
+ require_relative 'configuration'
23
23
 
24
24
  # Generic class to handle input files and directories in a general manner.
25
25
  class Input
@@ -20,7 +20,7 @@
20
20
  #++
21
21
  module Pandocomatic
22
22
  require 'tempfile'
23
- require_relative './input'
23
+ require_relative 'input'
24
24
 
25
25
  # A specific Input class to handle multiple input files
26
26
  class MultipleFilesInput < Input
@@ -95,10 +95,10 @@ module Pandocomatic
95
95
  metadata = PandocMetadata.load contents
96
96
 
97
97
  unless metadata.unique?
98
- warn "\nWarning: Encountered the pandocomatic metadata property in"\
99
- ' more than one YAML metadata block. Only the pandocomatic property'\
100
- ' from the first YAML metadata block is being used; the other'\
101
- " pandocomatic properties have been discarded.\n\n"
98
+ warn "\nWarning: Encountered the pandocomatic metadata property in " \
99
+ 'more than one YAML metadata block. Only the pandocomatic property ' \
100
+ 'from the first YAML metadata block is being used; the other ' \
101
+ "pandocomatic properties have been discarded.\n\n"
102
102
  end
103
103
 
104
104
  @tmp_file.write contents
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # Copyright 2014-2022, Huub de Beer <Huub@heerdebeer.org>
4
+ # Copyright 2014-2023, Huub de Beer <Huub@heerdebeer.org>
5
5
  #
6
6
  # This file is part of pandocomatic.
7
7
  #
@@ -23,12 +23,16 @@ module Pandocomatic
23
23
  require 'paru'
24
24
  require 'yaml'
25
25
 
26
- require_relative './error/pandoc_error'
27
- require_relative './error/io_error'
28
- require_relative './pandocomatic_yaml'
26
+ require_relative 'error/pandoc_metadata_error'
27
+ require_relative 'pandocomatic_yaml'
29
28
 
30
- # Regular expression to find metadata blocks in a string.
31
- METADATA_BLOCK = /^---[ \t]*(\r\n|\r|\n)(.+?)^(?:---|\.\.\.)[ \t]*(\r\n|\r|\n)/m.freeze
29
+ BLOCK_START = /^---[ \t]*$/
30
+
31
+ # Regular expression to find metadata blocks in a string. This regular
32
+ # expression does interfere with pandoc's horizontal line syntax when using
33
+ # three dashes for horizontal lines. Therefore, use four or more dashes in
34
+ # your pandoc documents.
35
+ METADATA_BLOCK = /^---[ \t]*(\r\n|\r|\n)(.+?)^(?:---|\.\.\.)[ \t]*(\r\n|\r|\n)/m
32
36
 
33
37
  # PandocMetadata represents the metadata with pandoc options set in
34
38
  # templates and input files.
@@ -58,6 +62,9 @@ module Pandocomatic
58
62
  # @param path [String|Nil] the path to the source of the input, if any
59
63
  # @return [PandocMetadata] the metadata in the source file, or an empty
60
64
  # one if no such metadata is contained in the source file.
65
+ #
66
+ # @raise [PandocomaticError] when the pandoc metadata cannot be
67
+ # extracted.
61
68
  def self.load(input, path = nil)
62
69
  yaml, pandocomatic_blocks = extract_metadata(input, path)
63
70
 
@@ -160,7 +167,8 @@ module Pandocomatic
160
167
  # Hash otherwise.
161
168
  def pandocomatic
162
169
  return self['pandocomatic'] if key? 'pandocomatic'
163
- return self['pandocomatic_'] if key? 'pandocomatic_'
170
+
171
+ self['pandocomatic_'] if key? 'pandocomatic_'
164
172
  end
165
173
 
166
174
  # Does this PandocMetadata object has a pandoc options property?
@@ -184,6 +192,8 @@ module Pandocomatic
184
192
  # If more than one pandocomatic property is contained in the input,
185
193
  # all but the first are discarded and are not present in the
186
194
  # extracted metadata YAML string.
195
+ #
196
+ # @raise [PandocomaticError] when pandoc metadata cannot be extracted.
187
197
  private_class_method def self.extract_metadata(input, path = nil)
188
198
  metadata_blocks = MetadataBlockList.new input, path
189
199
 
@@ -193,10 +203,12 @@ module Pandocomatic
193
203
  # List of YAML metadata blocks present in some input source file
194
204
  class MetadataBlockList
195
205
  def initialize(input, path)
196
- @metadata_blocks = input
197
- .scan(METADATA_BLOCK)
198
- .map { |match| PandocomaticYAML.load "---#{match.join}...", path }
199
- .select { |block| !block.nil? and !block.empty? }
206
+ blocks = extract_blocks input, path
207
+ if blocks.any? { |b| !b.is_a? Hash }
208
+ raise PandocMetadataError.new :found_horizontal_lines_with_three_dashes, nil, path
209
+ end
210
+
211
+ @metadata_blocks = blocks
200
212
  end
201
213
 
202
214
  # Count the number of metadata blocks with a "pandocomatic_" property.
@@ -219,6 +231,26 @@ module Pandocomatic
219
231
  .reverse
220
232
  .reduce({}) { |metadata, block| metadata.merge!(block) }
221
233
  end
234
+
235
+ private
236
+
237
+ def extract_blocks(input, path)
238
+ starts = input.scan(BLOCK_START)
239
+ if starts.empty?
240
+ # No YAML metadata blocks expected
241
+ return []
242
+ end
243
+
244
+ # Expect YAML metadata blocks
245
+ begin
246
+ input
247
+ .scan(METADATA_BLOCK)
248
+ .map { |match| PandocomaticYAML.load "---#{match.join}...", path }
249
+ .select { |block| !block.nil? and !block.empty? }
250
+ rescue StandardError => e
251
+ raise PandocMetadataError.new :expected_to_find_YAML_metadata_blocks, e, path
252
+ end
253
+ end
222
254
  end
223
255
 
224
256
  private_constant :MetadataBlockList
@@ -25,31 +25,30 @@ module Pandocomatic
25
25
  require 'paru'
26
26
  require 'tempfile'
27
27
 
28
- require_relative './error/pandocomatic_error'
29
- require_relative './error/pandoc_error'
28
+ require_relative 'error/pandocomatic_error'
29
+ require_relative 'error/pandoc_error'
30
30
 
31
- require_relative './cli'
31
+ require_relative 'cli'
32
32
 
33
- require_relative './printer/help_printer'
34
- require_relative './printer/version_printer'
35
- require_relative './printer/error_printer'
36
- require_relative './printer/configuration_errors_printer'
37
- require_relative './printer/finish_printer'
38
- require_relative './printer/summary_printer'
33
+ require_relative 'printer/help_printer'
34
+ require_relative 'printer/version_printer'
35
+ require_relative 'printer/error_printer'
36
+ require_relative 'printer/configuration_errors_printer'
37
+ require_relative 'printer/finish_printer'
38
+ require_relative 'printer/summary_printer'
39
39
 
40
- require_relative './command/convert_dir_command'
41
- require_relative './command/convert_list_command'
42
- require_relative './command/convert_file_command'
43
- require_relative './command/convert_file_multiple_command'
40
+ require_relative 'command/convert_dir_command'
41
+ require_relative 'command/convert_list_command'
42
+ require_relative 'command/convert_file_command'
43
+ require_relative 'command/convert_file_multiple_command'
44
+
45
+ require_relative 'version'
44
46
 
45
47
  # The Pandocomatic class controlls the pandocomatic conversion process
46
48
  class Pandocomatic
47
49
  # Pandocomatic error status codes start from ERROR_STATUS
48
50
  ERROR_STATUS = 1266 # This is the sum of the ASCII values of the characters in 'pandocomatic'
49
51
 
50
- # Pandocomatic's current version
51
- VERSION = [1, 1, 0].freeze
52
-
53
52
  # rubocop:disable Metrics
54
53
 
55
54
  # Run pandocomatic given options
@@ -22,7 +22,7 @@ module Pandocomatic
22
22
  require 'date'
23
23
  require 'yaml'
24
24
 
25
- require_relative './error/template_error'
25
+ require_relative 'error/template_error'
26
26
 
27
27
  # PandocomaticYAML is a wrapper around ruby's YAML library that replaces
28
28
  # occurrences of "$(X)$" in the YAML by the value of the evironment variable
@@ -32,7 +32,7 @@ module Pandocomatic
32
32
  PERMITTED_YAML_CLASSES = [Date].freeze
33
33
 
34
34
  # Regular expression representing environment variables in templates
35
- VAR_PATTERN = /\$\((?<var>[a-zA-Z_][a-zA-Z0-9_]*)\)\$/.freeze
35
+ VAR_PATTERN = /\$\((?<var>[a-zA-Z_][a-zA-Z0-9_]*)\)\$/
36
36
 
37
37
  # Load a string, substitute any variables, and parse as YAML.
38
38
  #
@@ -61,9 +61,9 @@ module Pandocomatic
61
61
  str.gsub(VAR_PATTERN) do |_match|
62
62
  key = Regexp.last_match(1)
63
63
 
64
- raise TemplateError.new :environment_variable_does_not_exist, { key: key, path: path } unless ENV.key? key
64
+ raise TemplateError.new(:environment_variable_does_not_exist, { key: key, path: path }) unless ENV.key? key
65
65
 
66
- ENV[key]
66
+ ENV.fetch(key, nil)
67
67
  end
68
68
  end
69
69
  end
@@ -87,7 +87,7 @@ module Pandocomatic
87
87
  # @return [Boolean]
88
88
  def self.local_path?(path)
89
89
  if Gem.win_platform?
90
- path.match("^\\.\\\\\.*$")
90
+ path.match('^\\.\\\\.*$')
91
91
  else
92
92
  path.start_with? './'
93
93
  end
@@ -99,7 +99,7 @@ module Pandocomatic
99
99
  # @return [Boolean]
100
100
  def self.absolute_path?(path)
101
101
  if Gem.win_platform?
102
- path.match("^[a-zA-Z]:\\\\\.*$")
102
+ path.match('^[a-zA-Z]:\\\\.*$')
103
103
  else
104
104
  path.start_with? '/'
105
105
  end
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './printer'
22
+ require_relative 'printer'
23
23
 
24
24
  # Printer for Commands in non-quiet mode
25
25
  class CommandPrinter < Printer
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './printer'
22
+ require_relative 'printer'
23
23
 
24
24
  # Printer for ConfigurationErrors in non-quiet mode
25
25
  class ConfigurationErrorsPrinter < Printer
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './printer'
22
+ require_relative 'printer'
23
23
 
24
24
  # Printer for Errors in non-quiet mode
25
25
  class ErrorPrinter < Printer
@@ -36,7 +36,7 @@ module Pandocomatic
36
36
 
37
37
  # Print an Error to STDERR rather than STDOUT
38
38
  def print
39
- warn to_s
39
+ warn self
40
40
  end
41
41
  end
42
42
  end
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './summary_printer'
22
+ require_relative 'summary_printer'
23
23
 
24
24
  # Printer for the end of the conversion process in non-quiet mode
25
25
  class FinishPrinter < SummaryPrinter
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './printer'
22
+ require_relative 'printer'
23
23
 
24
24
  # Printer for pandocomatic's help
25
25
  class HelpPrinter < Printer
@@ -49,7 +49,7 @@ module Pandocomatic
49
49
 
50
50
  # Print to STDOUT
51
51
  def print
52
- puts to_s
52
+ puts self
53
53
  end
54
54
  end
55
55
  end
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './printer'
22
+ require_relative 'printer'
23
23
 
24
24
  # Printer for printing a summary of the conversion process in non-quiet mode
25
25
  class SummaryPrinter < Printer
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './printer'
22
+ require_relative 'printer'
23
23
 
24
24
  # Printer to print pandocomatic's version
25
25
  class VersionPrinter < Printer
@@ -0,0 +1,4 @@
1
+ Expected to extract YAML metadata blocks from file '<%= @error.data %>', but did not succeed. Check YAML syntax of all metadata blocks; make sure that all horizontal lines have at least four (4) dashes.
2
+
3
+ <% if @error.error? %>Reported cause(s):
4
+ <%= @error.error.to_s %><% end %>
@@ -1,6 +1,6 @@
1
1
  Pandocomatic version <%=@version.join('.')%>
2
2
 
3
- © 2014—2021 Huub de Beer <huub@heerdebeer.org>
3
+ © 2014—2023 Huub de Beer <huub@heerdebeer.org>
4
4
 
5
5
  Pandocomatic is free software; pandocomatic is released under the GPLv3.
6
6
 
@@ -19,7 +19,7 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './printer'
22
+ require_relative 'printer'
23
23
 
24
24
  # Printer for warnings
25
25
  class WarningPrinter < Printer
@@ -34,7 +34,7 @@ module Pandocomatic
34
34
 
35
35
  # Print warnings to STDERR rather than STDOUT
36
36
  def print
37
- warn to_s
37
+ warn self
38
38
  end
39
39
  end
40
40
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # Copyright 2021 Huub de Beer <Huub@heerdebeer.org>
4
+ # Copyright 2023, Huub de Beer <Huub@heerdebeer.org>
5
5
  #
6
6
  # This file is part of pandocomatic.
7
7
  #
@@ -19,11 +19,6 @@
19
19
  # with pandocomatic. If not, see <http://www.gnu.org/licenses/>.
20
20
  #++
21
21
  module Pandocomatic
22
- require_relative './configuration'
23
-
24
- # Generic class to handle output in a general manner.
25
- class Output
26
- # Create a new Output
27
- def initialize; end
28
- end
22
+ # Pandocomatic's current version.
23
+ VERSION = [1, 1, 2].freeze
29
24
  end
metadata CHANGED
@@ -1,55 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandocomatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Huub de Beer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-09 00:00:00.000000000 Z
11
+ date: 2023-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: paru
14
+ name: optimist
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.1'
19
+ version: 3.0.0
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.1.0
22
+ version: 3.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '1.1'
29
+ version: 3.0.0
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.1.0
32
+ version: 3.0.0
33
33
  - !ruby/object:Gem::Dependency
34
- name: optimist
34
+ name: paru
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 3.0.0
39
+ version: '1.1'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 3.0.0
42
+ version: 1.1.2
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: 3.0.0
49
+ version: '1.1'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 3.0.0
52
+ version: 1.1.2
53
+ - !ruby/object:Gem::Dependency
54
+ name: minitest
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '5.15'
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '5.15'
53
67
  - !ruby/object:Gem::Dependency
54
68
  name: minitest-reporters
55
69
  requirement: !ruby/object:Gem::Requirement
@@ -65,33 +79,47 @@ dependencies:
65
79
  - !ruby/object:Gem::Version
66
80
  version: '1.5'
67
81
  - !ruby/object:Gem::Dependency
68
- name: yard
82
+ name: rake
69
83
  requirement: !ruby/object:Gem::Requirement
70
84
  requirements:
71
85
  - - "~>"
72
86
  - !ruby/object:Gem::Version
73
- version: 0.9.27
87
+ version: '13.0'
74
88
  type: :development
75
89
  prerelease: false
76
90
  version_requirements: !ruby/object:Gem::Requirement
77
91
  requirements:
78
92
  - - "~>"
79
93
  - !ruby/object:Gem::Version
80
- version: 0.9.27
94
+ version: '13.0'
81
95
  - !ruby/object:Gem::Dependency
82
96
  name: rubocop
83
97
  requirement: !ruby/object:Gem::Requirement
84
98
  requirements:
85
99
  - - "~>"
86
100
  - !ruby/object:Gem::Version
87
- version: 1.25.0
101
+ version: 1.56.4
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: 1.56.4
109
+ - !ruby/object:Gem::Dependency
110
+ name: yard
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: 0.9.27
88
116
  type: :development
89
117
  prerelease: false
90
118
  version_requirements: !ruby/object:Gem::Requirement
91
119
  requirements:
92
120
  - - "~>"
93
121
  - !ruby/object:Gem::Version
94
- version: 1.25.0
122
+ version: 0.9.27
95
123
  description: Pandocomatic is a tool to automate using pandoc. With pandocomatic you
96
124
  can express common patterns of using pandoc for generating your documents. Applied
97
125
  to a directory, pandocomatic can act as a static site generator.
@@ -117,12 +145,12 @@ files:
117
145
  - lib/pandocomatic/error/configuration_error.rb
118
146
  - lib/pandocomatic/error/io_error.rb
119
147
  - lib/pandocomatic/error/pandoc_error.rb
148
+ - lib/pandocomatic/error/pandoc_metadata_error.rb
120
149
  - lib/pandocomatic/error/pandocomatic_error.rb
121
150
  - lib/pandocomatic/error/processor_error.rb
122
151
  - lib/pandocomatic/error/template_error.rb
123
152
  - lib/pandocomatic/input.rb
124
153
  - lib/pandocomatic/multiple_files_input.rb
125
- - lib/pandocomatic/output.rb
126
154
  - lib/pandocomatic/pandoc_metadata.rb
127
155
  - lib/pandocomatic/pandocomatic.rb
128
156
  - lib/pandocomatic/pandocomatic_yaml.rb
@@ -144,6 +172,7 @@ files:
144
172
  - lib/pandocomatic/printer/views/help.txt
145
173
  - lib/pandocomatic/printer/views/io_error.txt
146
174
  - lib/pandocomatic/printer/views/pandoc_error.txt
175
+ - lib/pandocomatic/printer/views/pandoc_metadata_error.txt
147
176
  - lib/pandocomatic/printer/views/processor_error.txt
148
177
  - lib/pandocomatic/printer/views/summary.txt
149
178
  - lib/pandocomatic/printer/views/template_error.txt
@@ -154,12 +183,14 @@ files:
154
183
  - lib/pandocomatic/processors/fileinfo_preprocessor.rb
155
184
  - lib/pandocomatic/processors/metadata_preprocessor.rb
156
185
  - lib/pandocomatic/template.rb
186
+ - lib/pandocomatic/version.rb
157
187
  - lib/pandocomatic/warning.rb
158
188
  homepage: https://heerdebeer.org/Software/markdown/pandocomatic/
159
189
  licenses:
160
190
  - GPL-3.0
161
- metadata: {}
162
- post_install_message:
191
+ metadata:
192
+ rubygems_mfa_required: 'true'
193
+ post_install_message:
163
194
  rdoc_options: []
164
195
  require_paths:
165
196
  - lib
@@ -175,8 +206,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
206
  version: '0'
176
207
  requirements:
177
208
  - pandoc, a universal document converter
178
- rubygems_version: 3.4.1
179
- signing_key:
209
+ rubygems_version: 3.4.10
210
+ signing_key:
180
211
  specification_version: 4
181
212
  summary: Automate the use of pandoc
182
213
  test_files: []