class IsoDoc::PdfConvert

Public Class Methods

new(options) click to toggle source
Calls superclass method IsoDoc::Convert::new
# File lib/isodoc/pdf_convert.rb, line 12
def initialize(options)
  @standardstylesheet = nil
  super
  @format = :pdf
  @suffix = "pdf"
  @scripts = @scripts_pdf if @scripts_pdf
  @maxwidth = 500
  @maxheight = 800
end

Public Instance Methods

convert(input_filename, file = nil, debug = false, output_filename = nil) click to toggle source
# File lib/isodoc/pdf_convert.rb, line 26
def convert(input_filename, file = nil, debug = false, output_filename = nil)
  file = File.read(input_filename, encoding: "utf-8") if file.nil?
  @openmathdelim, @closemathdelim = extract_delims(file)
  docxml, filename, dir = convert_init(file, input_filename, debug)
  result = convert1(docxml, filename, dir)
  return result if debug

  postprocess(result, "#{filename}.tmp.html", dir)
  FileUtils.rm_rf dir
  ::Metanorma::Output::Pdf.new.convert(
    "#{filename}.tmp.html",
    output_filename || "#{filename}.#{@suffix}",
  )
  FileUtils.rm_rf ["#{filename}.tmp.html", tmpimagedir]
end
tmpimagedir_suffix() click to toggle source
# File lib/isodoc/pdf_convert.rb, line 22
def tmpimagedir_suffix
  "_pdfimages"
end
xref_parse(node, out) click to toggle source
# File lib/isodoc/pdf_convert.rb, line 42
def xref_parse(node, out)
  out.a(**{ "href": target_pdf(node) }) { |l| l << get_linkend(node) }
end