class IsoDoc::BIPM::PdfConvert

A {Converter} implementation that generates PDF HTML output, and a document schema encapsulation of the document for validation

Public Class Methods

new(options) click to toggle source
Calls superclass method
# File lib/isodoc/bipm/pdf_convert.rb, line 8
def initialize(options)
  @libdir = File.dirname(__FILE__)
  super
end

Public Instance Methods

configuration() click to toggle source
# File lib/isodoc/bipm/pdf_convert.rb, line 13
def configuration
  Metanorma::BIPM.configuration
end
pdf_options(docxml) click to toggle source
Calls superclass method
# File lib/isodoc/bipm/pdf_convert.rb, line 28
def pdf_options(docxml)
  n = configuration.document_namespace
  q = "//m:bipm-standard/m:bibdata/m:language[@current = 'true']"
  if docxml.root.name == "metanorma-collection" &&
      docxml.at("#{q}[. = 'fr']", "m" => n) &&
      docxml.at("#{q}[. = 'en']", "m" => n)
    "#{super} --split-by-language"
  else
    super
  end
end
pdf_stylesheet(docxml) click to toggle source
# File lib/isodoc/bipm/pdf_convert.rb, line 17
def pdf_stylesheet(docxml)
  docxml&.at(ns("//bibdata/ext/editorialgroup/committee/@acronym"))
  &.value == "JCGM" and
    return "jcgm.standard.xsl"

  doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
  doctype = "brochure" unless %w(guide mise-en-pratique rapport)
    .include? doctype
  "bipm.#{doctype}.xsl"
end