Sha256: 49e5c966d76c02019f09788e25e4616d02248e67a8cb8a844760f4ee53dfaffa

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

require "metanorma/processor"

module Metanorma
  module Sample
    class Processor < Metanorma::Processor

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

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

      def version
        "Metanorma::Sample #{Metanorma::Sample::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::Sample::HtmlConvert.new(options).convert(outname, isodoc_node)
        when :doc
          IsoDoc::Sample::WordConvert.new(options).convert(outname, isodoc_node)
        when :pdf
          IsoDoc::Sample::PdfConvert.new(options).convert(outname, isodoc_node)
        else
          super
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
metanorma-sample-1.3.11 lib/metanorma/sample/processor.rb
metanorma-sample-1.3.9 lib/metanorma/sample/processor.rb
metanorma-sample-1.3.8 lib/metanorma/sample/processor.rb
metanorma-sample-1.0.10 lib/metanorma/sample/processor.rb