Sha256: 6b4c2ccf308b1e4399ad649c9e5d202f88dfa7031bc7317efde8850d29966d67

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

require "metanorma/processor"

module Metanorma
  module Unece
    class Processor < Metanorma::Processor

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

      def output_formats
        super.merge(
          html: "html",
          doc: "doc",
          pdf: "pdf",
        )
      end

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

      def input_to_isodoc(file, filename)
        Metanorma::Unece::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
      end

      def output(isodoc_node, outname, format, options={})
        case format
        when :html
          IsoDoc::Unece::HtmlConvert.new(options).convert(outname, isodoc_node)
        when :doc
          IsoDoc::Unece::WordConvert.new(options).convert(outname, isodoc_node)
        when :pdf
          IsoDoc::Unece::PdfConvert.new(options).convert(outname, isodoc_node)
        else
          super
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
metanorma-unece-0.2.14 lib/metanorma/unece/processor.rb
metanorma-unece-0.2.13 lib/metanorma/unece/processor.rb
metanorma-unece-0.2.12 lib/metanorma/unece/processor.rb
metanorma-unece-0.2.11 lib/metanorma/unece/processor.rb
metanorma-unece-0.2.10 lib/metanorma/unece/processor.rb
metanorma-unece-0.2.9 lib/metanorma/unece/processor.rb