Sha256: 900c63e06777594c645a84e5a704228abe922e0f294357f0c7559b58667fd374

Contents?: true

Size: 1.81 KB

Versions: 9

Compression:

Stored size: 1.81 KB

Contents

require "metanorma/processor"

module Metanorma
  module Iso
    class Processor < Metanorma::Processor

      def initialize
        @short = :iso
        @input_format = :asciidoc
        @asciidoctor_backend = :iso
      end

      def output_formats
        super.merge(
          html: "html",
          html_alt: "alt.html",
          doc: "doc",
          pdf: "pdf",
          sts: "sts.xml",
          isosts: "iso.sts.xml"
        )
      end

      def version
        "Metanorma::ISO #{Metanorma::ISO::VERSION}"
      end

      def fonts_manifest
        {
          "Cambria" => nil,
          "Cambria Math" => nil,
          "Times New Roman" => nil,
          "Source Han Sans" => nil,
          "Courier" => nil,
          "Courier New" => nil,
        }
      end

      def use_presentation_xml(ext)
        return true if ext == :html_alt

        super
      end

      def output(isodoc_node, inname, outname, format, options={})
        case format
        when :html
          IsoDoc::Iso::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
        when :html_alt
          IsoDoc::Iso::HtmlConvert.new(options.merge(alt: true)).convert(inname, isodoc_node, nil, outname)
        when :doc
          IsoDoc::Iso::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
        when :pdf
          IsoDoc::Iso::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
        when :sts
          IsoDoc::Iso::StsConvert.new(options).convert(inname, isodoc_node, nil, outname)
        when :isosts
          IsoDoc::Iso::IsoStsConvert.new(options).convert(inname, isodoc_node, nil, outname)
        when :presentation
          IsoDoc::Iso::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
        else
          super
        end
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
metanorma-iso-1.9.1 lib/metanorma/iso/processor.rb
metanorma-iso-1.9.0.1 lib/metanorma/iso/processor.rb
metanorma-iso-1.9.0 lib/metanorma/iso/processor.rb
metanorma-iso-1.8.6 lib/metanorma/iso/processor.rb
metanorma-iso-1.8.5 lib/metanorma/iso/processor.rb
metanorma-iso-1.8.4 lib/metanorma/iso/processor.rb
metanorma-iso-1.8.3 lib/metanorma/iso/processor.rb
metanorma-iso-1.8.2 lib/metanorma/iso/processor.rb
metanorma-iso-1.8.1 lib/metanorma/iso/processor.rb