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
- #get_input_fname(input_fname) ⇒ 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
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/isodoc/iso/isosts_convert.rb', line 25 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) input_fname = get_input_fname(input_fname) FileUtils.rm_rf dir MnConvert.convert(input_fname, { input_format: MnConvert::InputFormat::MN, output_file: output_fname || "#{fname}.#{@suffix}", output_format: :iso, }) end |
#get_input_fname(input_fname) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/isodoc/iso/isosts_convert.rb', line 16 def get_input_fname(input_fname) /\.xml$/.match(input_fname) or input_fname = Tempfile.open([fname, ".xml"], encoding: "utf-8") do |f| f.write file f.path end input_fname end |