Sha256: 5a6123ca63426d0f604c58c7fd194e8b3c928f24572ba8178414115cf32e5191

Contents?: true

Size: 910 Bytes

Versions: 10

Compression:

Stored size: 910 Bytes

Contents

require "isodoc"
require "mnconvert"

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)
        /\.xml$/.match?(in_fname) or
          in_fname = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
            f.write file
            f.path
          end
        FileUtils.rm_rf dir
        MnConvert.convert(in_fname,
                          { input_format: MnConvert::InputFormat::MN,
                            output_file: out_fname || "#{filename}.#{@suffix}" })
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
metanorma-iso-2.0.6.1 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.0.6 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.0.5 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.0.4 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.0.3 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.0.2 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.0.1 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.0.0 lib/isodoc/iso/sts_convert.rb
metanorma-iso-1.10.6 lib/isodoc/iso/sts_convert.rb
metanorma-iso-1.10.5 lib/isodoc/iso/sts_convert.rb