Sha256: 0259414d61e5b76a1f9dbbe31d287ab3a2c4db2123b441186e1782813b32d071

Contents?: true

Size: 954 Bytes

Versions: 1

Compression:

Stored size: 954 Bytes

Contents

require "isodoc"
require "mn2sts"

module IsoDoc
  module BSI

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metanorma-bsi-0.0.1 lib/isodoc/bsi/sts_convert.rb