Class: IsoDoc::Iso::StsConvert
- Inherits:
-
XslfoPdfConvert
- Object
- XslfoPdfConvert
- IsoDoc::Iso::StsConvert
- Defined in:
- lib/isodoc/iso/sts_convert.rb
Instance Method Summary collapse
- #convert(in_fname, file = nil, debug = false, out_fname = nil) ⇒ Object
-
#initialize(_options) ⇒ StsConvert
constructor
rubocop:disable Lint/MissingSuper.
- #inputfile(in_fname, filename) ⇒ Object
Constructor Details
#initialize(_options) ⇒ StsConvert
rubocop:disable Lint/MissingSuper
7 8 9 10 11 |
# File 'lib/isodoc/iso/sts_convert.rb', line 7 def initialize() # rubocop:disable Lint/MissingSuper @libdir = File.dirname(__FILE__) @format = :sts @suffix = "sts.xml" end |
Instance Method Details
#convert(in_fname, file = nil, debug = false, out_fname = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/isodoc/iso/sts_convert.rb', line 22 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 |
#inputfile(in_fname, filename) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/isodoc/iso/sts_convert.rb', line 13 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 |