54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/coradoc/cli.rb', line 54
def convert(input = nil)
options[:require]&.each { |r| Kernel.require r }
config = {
input_options: input_options = {},
input_processor: nil,
output_options: output_options = {},
output_processor: nil,
}
config[:input_processor] = options[:input_format]&.to_sym
config[:output_processor] = options[:output_format]&.to_sym
%i[
external_images
unknown_tags
mathml2asciimath
track_time
split_sections
].each do |i|
input_options[i] = options[i]
end
output = options[:output]
begin
Coradoc::Converter.(input, output, **config)
rescue Converter::NoInputPathError => e
warn "You must provide INPUT file as a file for this optionset."
warn "Detail: #{e.message}"
rescue Converter::NoOutputPathError => e
warn "You must provide OUTPUT file as a file for this optionset."
warn "Detail: #{e.message}"
rescue Converter::NoProcessorError => e
warn "No processor found for given input/output."
warn "Hint: set -I/--input-format or -O/--output-format option."
warn "Detail: #{e.message}"
end
end
|