lib/libis/format/converter/office_converter.rb in libis-format-1.3.4 vs lib/libis/format/converter/office_converter.rb in libis-format-2.0.0

- old
+ new

@@ -1,50 +1,56 @@ -# frozen_string_literal: true +# encoding: utf-8 require_relative 'base' require 'libis/format/tool/office_to_pdf' -require 'libis/format/type_database' +require 'libis/format/library' module Libis module Format module Converter + class OfficeConverter < Libis::Format::Converter::Base + def self.input_types - %i[ - TXT - RTF - HTML - MSDOC - MSDOT - MSXLS - MSPPT - MSDOCX - MSDOTX - MSXLSX - MSPPTX - WORDPERFECT - OO_WRITER - OO_IMPRESS - OO_CALC + [ + :TXT, + :RTF, + :HTML, + :MSDOC, + :MSDOT, + :MSXLS, + :MSPPT, + :MSDOCX, + :MSDOTX, + :MSXLSX, + :MSPPTX, + :WORDPERFECT, + :OO_WRITER, + :OO_IMPRESS, + :OO_CALC ] end def self.output_types(format = nil) - return [] unless input_types.include?(format) - + return [] unless input_types.include?(format) if format [:PDF] end def office_convert(_) - # force usage of this converter + #force usage of this converter end def convert(source, target, format, opts = {}) super - Format::Tool::OfficeToPdf.run(source, target) + return nil unless Format::Tool::OfficeToPdf.run(source, target) + + target + end + end + end end end