Class: Metanorma::Standoc::Processor

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

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProcessor

rubocop:disable Lint/MissingSuper



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

def initialize # rubocop:disable Lint/MissingSuper
  @short = :standoc
  @input_format = :asciidoc
  @asciidoctor_backend = :standoc
end

Class Attribute Details

.asciidoctor_backendObject (readonly)

Returns the value of attribute asciidoctor_backend.



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

def asciidoctor_backend
  @asciidoctor_backend
end

Instance Method Details

#html_path(file) ⇒ Object



29
30
31
32
# File 'lib/metanorma/standoc/processor.rb', line 29

def html_path(file)
  File.join(File.dirname(__FILE__), "..", "..", "isodoc", "html",
            file)
end

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



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/metanorma/standoc/processor.rb', line 34

def output(isodoc_node, inname, outname, format, options = {})
  options_preprocess(options)
  case format
  when :html
    options = options
      .merge(htmlstylesheet: html_path("htmlstyle.scss"),
             htmlcoverpage: html_path("html_titlepage.html"))
    IsoDoc::HtmlConvert.new(options)
      .convert(inname, isodoc_node, nil, outname)
  when :doc
    IsoDoc::WordConvert.new(options)
      .convert(inname, isodoc_node, nil, outname)
  when :pdf
    IsoDoc::Standoc::PdfConvert.new(options)
      .convert(inname, isodoc_node, nil, outname)
  when :presentation
    IsoDoc::PresentationXMLConvert.new(options)
      .convert(inname, isodoc_node, nil, outname)
  else
    super
  end
end

#output_formatsObject



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

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

#versionObject



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

def version
  "Metanorma::Standoc #{Metanorma::Standoc::VERSION}/" \
    "IsoDoc #{IsoDoc::VERSION}"
end