Sha256: c2f4813ccae7edd0140d1d7579d5d64052d8576f1008e2da245727a3a5c35cd9

Contents?: true

Size: 1 KB

Versions: 70

Compression:

Stored size: 1 KB

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 inputfile(in_fname, filename)
        /\.xml$/.match?(in_fname) or
          in_fname = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
            f.write file
            f.path
          end
        in_fname
      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)
        in_fname = inputfile(in_fname, filename)
        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

70 entries across 70 versions & 1 rubygems

Version Path
metanorma-iso-2.9.5 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.9.4 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.9.3 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.9.2 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.9.1 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.9.0 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.8.9 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.8.8 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.8.7 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.8.6 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.8.5 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.8.4 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.8.3 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.8.2 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.8.1 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.8.0 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.7.10 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.7.9 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.7.8 lib/isodoc/iso/sts_convert.rb
metanorma-iso-2.7.7 lib/isodoc/iso/sts_convert.rb