Method: IsoDoc::PdfConvert#convert

Defined in:
lib/isodoc/pdf_convert.rb

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



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/isodoc/pdf_convert.rb', line 22

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_r ["#{filename}.html", tmpimagedir]
end