Class: IsoDoc::Bipm::PdfConvert

Inherits:
Generic::PdfConvert
  • Object
show all
Includes:
BaseConvert, Init
Defined in:
lib/isodoc/bipm/pdf_convert.rb

Instance Attribute Summary

Attributes included from BaseConvert

#jcgm

Instance Method Summary collapse

Methods included from BaseConvert

#configuration, #convert1, #middle_clause, #table_footnote?, #term_cleanup

Methods included from Init

#amd?, #bibrenderer, #i18n_init, #metadata_init, #xref_init

Constructor Details

#initialize(options) ⇒ PdfConvert

Returns a new instance of PdfConvert.



8
9
10
11
# File 'lib/isodoc/bipm/pdf_convert.rb', line 8

def initialize(options)
  super
  @libdir = File.dirname(__FILE__)
end

Instance Method Details

#pdf_options(docxml, filename) ⇒ Object



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

def pdf_options(docxml, filename)
  n = configuration.document_namespace
  q = "//m:metanorma/m:bibdata/m:language[@current = 'true']"
  if docxml.root.name == "metanorma-collection" &&
      docxml.at("#{q}[. = 'fr']", "m" => n) &&
      docxml.at("#{q}[. = 'en']", "m" => n)
    return super.tap do |h|
      h["--split-by-language"] = nil
    end
  end
  super
end

#pdf_stylesheet(docxml) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/isodoc/bipm/pdf_convert.rb', line 13

def pdf_stylesheet(docxml)
  docxml&.at(ns("//bibdata/ext/editorialgroup/committee/@acronym"))
    &.value == "JCGM" and
    return "jcgm.standard.xsl"

  doctype = @doctype
  doctype = "brochure" unless %w(guide mise-en-pratique rapport)
    .include? doctype
  "bipm.#{doctype}.xsl"
end