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.
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
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/isodoc/iso/sts_convert.rb', line 13 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) /\.xml$/.match?(in_fname) or in_fname = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f| f.write file f.path end FileUtils.rm_rf dir MnConvert.convert(in_fname, out_fname || "#{filename}.#{@suffix}", MnConvert::InputFormat::MN) end |