lib/metanorma/compile.rb in metanorma-1.5.4 vs lib/metanorma/compile.rb in metanorma-1.5.5

- old
+ new

@@ -40,11 +40,11 @@ def process_input(filename, options) case extname = File.extname(filename) when ".adoc" then process_input_adoc(filename, options) when ".xml" then process_input_xml(filename, options) else - Util.log("[metanorma] Error: file extension #{extname} "\ + Util.log("[metanorma] Error: file extension #{extname} " \ "is not supported.", :error) nil end end @@ -148,29 +148,31 @@ def process_output_threaded(ext, fnames1, options1, isodoc_options1) @processor.output(nil, fnames1[:presentationxml], fnames1[:out], ext, isodoc_options1) wrap_html(options1, fnames1[:ext], fnames1[:out]) rescue StandardError => e - isodoc_error_process(e) + strict = ext == :presentation || isodoc_options1[:strict] == "true" + isodoc_error_process(e, strict) end def process_output_unthreaded(ext, fnames, isodoc, isodoc_options) @processor.output(isodoc, fnames[:xml], fnames[:out], ext, isodoc_options) nil # return as Thread rescue StandardError => e - isodoc_error_process(e) + strict = ext == :presentation || isodoc_options[:strict] == "true" + isodoc_error_process(e, strict) end private - def isodoc_error_process(err) - if err.message.include? "Fatal:" + def isodoc_error_process(err, strict) + if strict || err.message.include?("Fatal:") @errors << err.message else puts err.message - puts err.backtrace.join("\n") end + puts err.backtrace.join("\n") end # @param options [Hash] # @return [String] def change_output_dir(options)