Sha256: de77bf48677d8dfa4d766a8595c2292191f7b8e0f57596f0a041e1bd464406b8

Contents?: true

Size: 1.09 KB

Versions: 9

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require 'metanorma/processor'
require 'asciidoctor/csa/converter'

module Metanorma
  module Csa
    class Processor < Metanorma::Processor

      def initialize
        @short = :csa
        @input_format = :asciidoc
        @asciidoctor_backend = Asciidoctor::Csa::CSA_TYPE.to_sym
      end

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

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

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
metanorma-csa-1.4.8 lib/metanorma/csa/processor.rb
metanorma-csa-1.4.7 lib/metanorma/csa/processor.rb
metanorma-csa-1.4.6 lib/metanorma/csa/processor.rb
metanorma-csa-1.4.5 lib/metanorma/csa/processor.rb
metanorma-csa-1.4.4 lib/metanorma/csa/processor.rb
metanorma-csa-1.4.3 lib/metanorma/csa/processor.rb
metanorma-csa-1.4.2 lib/metanorma/csa/processor.rb
metanorma-csa-1.4.1 lib/metanorma/csa/processor.rb
metanorma-csa-1.4.0 lib/metanorma/csa/processor.rb