Sha256: dec74fc0dc7005f18f6b8d4368b7f310032a4846441506e4ea2584087bb13cf7

Contents?: true

Size: 999 Bytes

Versions: 11

Compression:

Stored size: 999 Bytes

Contents

require "isodoc"
require "mnconvert"

module IsoDoc
  module Iso
    # A {Converter} implementation that generates HTML output, and a document
    # schema encapsulation of the document for validation
    #
    class IsoStsConvert < IsoDoc::XslfoPdfConvert
      def initialize(_options)
        @libdir = File.dirname(__FILE__)
        @format = :isosts
        @suffix = "isosts.xml"
      end

      def convert(input_fname, file = nil, debug = false, output_fname = nil)
        file = File.read(input_fname, encoding: "utf-8") if file.nil?
        _, fname, dir = convert_init(file, input_fname, debug)
        /\.xml$/.match(input_fname) or
          input_fname = Tempfile.open([fname, ".xml"], encoding: "utf-8") do |f|
            f.write file
            f.path
          end
        FileUtils.rm_rf dir
        MnConvert.convert(input_fname, output_fname || "#{fname}.#{@suffix}",
                          MnConvert::InputFormat::MN, { output_format: :iso })
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
metanorma-iso-1.10.2 lib/isodoc/iso/isosts_convert.rb
metanorma-iso-1.10.1 lib/isodoc/iso/isosts_convert.rb
metanorma-iso-1.10.0 lib/isodoc/iso/isosts_convert.rb
metanorma-iso-1.9.6 lib/isodoc/iso/isosts_convert.rb
metanorma-iso-1.9.5 lib/isodoc/iso/isosts_convert.rb
metanorma-iso-1.9.4 lib/isodoc/iso/isosts_convert.rb
metanorma-iso-1.9.3 lib/isodoc/iso/isosts_convert.rb
metanorma-iso-1.9.2 lib/isodoc/iso/isosts_convert.rb
metanorma-iso-1.9.1 lib/isodoc/iso/isosts_convert.rb
metanorma-iso-1.9.0.1 lib/isodoc/iso/isosts_convert.rb
metanorma-iso-1.9.0 lib/isodoc/iso/isosts_convert.rb