Sha256: f7670feca9a83b49c6c119de9c807933e48480542b1c713b5672b139e2d0a8b6

Contents?: true

Size: 1.27 KB

Versions: 36

Compression:

Stored size: 1.27 KB

Contents

require_relative "html_function/comments.rb"
require_relative "html_function/footnotes.rb"
require_relative "html_function/html.rb"
require "metanorma"

module IsoDoc
  class PdfConvert < ::IsoDoc::Convert

    include HtmlFunction::Comments
    include HtmlFunction::Footnotes
    include HtmlFunction::Html

    def initialize(options)
      @standardstylesheet = nil
      super
      @scripts = @scripts_pdf if @scripts_pdf
      @maxwidth = 500
      @maxheight = 800
    end

    def tmpimagedir_suffix
      "_pdfimages"
    end

    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

    def xref_parse(node, out)
      target = /#/.match(node["target"]) ? node["target"].sub(/#/, ".pdf#") :
        "##{node["target"]}"
      out.a(**{ "href": target }) { |l| l << get_linkend(node) }
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
isodoc-1.0.25 lib/isodoc/pdf_convert.rb
isodoc-1.0.24 lib/isodoc/pdf_convert.rb
isodoc-1.0.23 lib/isodoc/pdf_convert.rb
isodoc-1.0.22 lib/isodoc/pdf_convert.rb
isodoc-1.0.21 lib/isodoc/pdf_convert.rb
isodoc-1.0.20 lib/isodoc/pdf_convert.rb
isodoc-1.0.19 lib/isodoc/pdf_convert.rb
isodoc-1.0.18 lib/isodoc/pdf_convert.rb
isodoc-1.0.17 lib/isodoc/pdf_convert.rb
isodoc-1.0.16 lib/isodoc/pdf_convert.rb
isodoc-1.0.15 lib/isodoc/pdf_convert.rb
isodoc-1.0.14 lib/isodoc/pdf_convert.rb
isodoc-1.0.13 lib/isodoc/pdf_convert.rb
isodoc-1.0.12 lib/isodoc/pdf_convert.rb
isodoc-1.0.11 lib/isodoc/pdf_convert.rb
isodoc-1.0.10 lib/isodoc/pdf_convert.rb
isodoc-1.0.9 lib/isodoc/pdf_convert.rb
isodoc-1.0.8 lib/isodoc/pdf_convert.rb
isodoc-1.0.7 lib/isodoc/pdf_convert.rb
isodoc-1.0.6 lib/isodoc/pdf_convert.rb