Sha256: 5fe5431a126652564a1952c1721442a86d4efee484467f5ec51ca9ea27c27dec

Contents?: true

Size: 808 Bytes

Versions: 5

Compression:

Stored size: 808 Bytes

Contents

require "isodoc"
require "mn2sts"

module IsoDoc
  module Iso

    class StsConvert < IsoDoc::XslfoPdfConvert
      def initialize(_options) # rubocop:disable Lint/MissingSuper
        @libdir = File.dirname(__FILE__)
        @format = :sts
        @suffix = "sts.xml"
      end

      def convert(in_fname, file = nil, debug = false, out_fname = nil)
        file = File.read(in_fname, encoding: "utf-8") if file.nil?
        _docxml, filename, dir = convert_init(file, in_fname, debug)
        unless /\.xml$/.match?(in_fname)
          in_fname = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
            f.write file
            f.path
          end
        end
        FileUtils.rm_rf dir
        Mn2sts.convert(in_fname, out_fname || "#{filename}.#{@suffix}")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
metanorma-iso-1.8.6 lib/isodoc/iso/sts_convert.rb
metanorma-iso-1.8.5 lib/isodoc/iso/sts_convert.rb
metanorma-iso-1.8.4 lib/isodoc/iso/sts_convert.rb
metanorma-iso-1.8.3 lib/isodoc/iso/sts_convert.rb
metanorma-iso-1.8.2 lib/isodoc/iso/sts_convert.rb