Class: Metanorma::Processor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProcessor

Returns a new instance of Processor.



11
12
13
# File 'lib/metanorma/processor.rb', line 11

def initialize
  raise "This is an abstract class!"
end

Instance Attribute Details

#asciidoctor_backendObject (readonly)

Returns the value of attribute asciidoctor_backend.



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

def asciidoctor_backend
  @asciidoctor_backend
end

#input_formatObject (readonly)

Returns the value of attribute input_format.



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

def input_format
  @input_format
end

#shortObject (readonly)

Returns the value of attribute short.



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

def short
  @short
end

Instance Method Details

#extract_metanorma_options(file) ⇒ Object



47
48
49
# File 'lib/metanorma/processor.rb', line 47

def extract_metanorma_options(file)
  Metanorma::Input::Asciidoc.new.extract_metanorma_options(file)
end

#extract_options(file) ⇒ Object



43
44
45
# File 'lib/metanorma/processor.rb', line 43

def extract_options(file)
  Metanorma::Input::Asciidoc.new.extract_options(file)
end

#input_to_isodoc(file, filename, options = {}) ⇒ Object



23
24
25
# File 'lib/metanorma/processor.rb', line 23

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

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



39
40
41
# File 'lib/metanorma/processor.rb', line 39

def output(isodoc_node, inname, outname, format, options={})
  File.open(outname, "w:UTF-8") { |f| f.write(isodoc_node) }
end

#output_formatsObject



15
16
17
18
19
20
21
# File 'lib/metanorma/processor.rb', line 15

def output_formats
  {
    xml: "xml",
    presentation: "presentation.xml",
    rxl: "rxl"
  }
end

#use_presentation_xml(ext) ⇒ Object

def input_to_isodoc(file, filename)

raise "This is an abstract class!"

end



31
32
33
34
35
36
37
# File 'lib/metanorma/processor.rb', line 31

def use_presentation_xml(ext)
  case ext
  when :html, :doc, :pdf then true
  else
    false
  end
end