Sha256: 2182b029e6888dcae6ffa50942f3f5118cf07711dd808eae8fb8f3f40e626334

Contents?: true

Size: 1.81 KB

Versions: 8

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

8 entries across 8 versions & 1 rubygems

Version Path
metanorma-iso-1.8.0 lib/metanorma/iso/processor.rb
metanorma-iso-1.7.4 lib/metanorma/iso/processor.rb
metanorma-iso-1.7.3 lib/metanorma/iso/processor.rb
metanorma-iso-1.7.2 lib/metanorma/iso/processor.rb
metanorma-iso-1.7.1 lib/metanorma/iso/processor.rb
metanorma-iso-1.7.0 lib/metanorma/iso/processor.rb
metanorma-iso-1.6.1 lib/metanorma/iso/processor.rb
metanorma-iso-1.6.0 lib/metanorma/iso/processor.rb