Sha256: bb982e833b0f11004e8921379a9c6991dded30d8b5bf7a04dc103aa1c1fb7ee9

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

require "isodoc"

module IsoDoc
  module BIPM
    # A {Converter} implementation that generates PDF HTML output, and a
    # document schema encapsulation of the document for validation
    class PdfConvert <  IsoDoc::XslfoPdfConvert
      def initialize(options)
        @libdir = File.dirname(__FILE__)
        super
      end

      def configuration
        Metanorma::BIPM.configuration
      end

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

      def pdf_options(docxml)
        if docxml.root.name == "metanorma-collection" &&
            docxml.at("//m:bipm-standard/m:bibdata/m:language[@current = 'true'][. = 'fr']",
                      "m" => configuration.document_namespace) &&
            docxml.at("//m:bipm-standard/m:bibdata/m:language[@current = 'true'][. = 'en']",
                      "m" => configuration.document_namespace)
          "--split-by-language"
        else
          super
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
metanorma-bipm-1.0.2 lib/isodoc/bipm/pdf_convert.rb
metanorma-bipm-1.0.1 lib/isodoc/bipm/pdf_convert.rb
metanorma-bipm-1.0.0 lib/isodoc/bipm/pdf_convert.rb