Class: Metanorma::Unece::Processor

Inherits:
Processor
  • Object
show all
Defined in:
lib/metanorma/unece/processor.rb

Instance Method Summary collapse

Constructor Details

#initializeProcessor

Returns a new instance of Processor.



7
8
9
10
11
# File 'lib/metanorma/unece/processor.rb', line 7

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

Instance Method Details

#input_to_isodoc(file, filename) ⇒ Object



25
26
27
# File 'lib/metanorma/unece/processor.rb', line 25

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

#output(isodoc_node, outname, format, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/metanorma/unece/processor.rb', line 29

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

#output_formatsObject



13
14
15
16
17
18
19
# File 'lib/metanorma/unece/processor.rb', line 13

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

#versionObject



21
22
23
# File 'lib/metanorma/unece/processor.rb', line 21

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