Method: IsoDoc::PdfConvert#convert

Defined in:
lib/isodoc/pdf_convert.rb

#convert(filename, file = nil, debug = false) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/isodoc/pdf_convert.rb', line 25

def convert(filename, file = nil, debug = false)
  file = File.read(filename, encoding: "utf-8") if file.nil?
  @openmathdelim, @closemathdelim = extract_delims(file)
  docxml, outname_html, dir = convert_init(file, filename, debug)
  result = convert1(docxml, filename, dir)
  return result if debug
  postprocess(result, filename, dir)
  FileUtils.rm_rf dir
  ::Metanorma::Output::Pdf.new.convert("#{filename}.html", outname_html + ".pdf")
  FileUtils.rm_rf ["#{filename}.html", tmpimagedir]
end