Class: IsoDoc::Iso::IsoStsConvert
- Inherits:
-
XslfoPdfConvert
- Object
- XslfoPdfConvert
- IsoDoc::Iso::IsoStsConvert
- Defined in:
- lib/isodoc/iso/isosts_convert.rb
Overview
A Converter implementation that generates HTML output, and a document schema encapsulation of the document for validation
Instance Method Summary collapse
- #convert(input_fname, file = nil, debug = false, output_fname = nil) ⇒ Object
-
#initialize(_options) ⇒ IsoStsConvert
constructor
A new instance of IsoStsConvert.
Constructor Details
#initialize(_options) ⇒ IsoStsConvert
Returns a new instance of IsoStsConvert.
10 11 12 13 14 |
# File 'lib/isodoc/iso/isosts_convert.rb', line 10 def initialize() @libdir = File.dirname(__FILE__) @format = :isosts @suffix = "isosts.xml" end |
Instance Method Details
#convert(input_fname, file = nil, debug = false, output_fname = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/isodoc/iso/isosts_convert.rb', line 16 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, { input_format: MnConvert::InputFormat::MN, output_file: output_fname || "#{fname}.#{@suffix}", output_format: :iso, }) end |