Class: Metanorma::Standoc::Processor

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

Instance Method Summary collapse

Constructor Details

#initializeProcessor

rubocop:disable Lint/MissingSuper



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

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

Instance Method Details

#html_path(file) ⇒ Object



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

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

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



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/metanorma/standoc/processor.rb', line 28

def output(isodoc_node, inname, outname, format, 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



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

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

#versionObject



20
21
22
# File 'lib/metanorma/standoc/processor.rb', line 20

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