class Metanorma::Acme::Processor

Public Class Methods

new() click to toggle source
# File lib/metanorma/acme/processor.rb, line 6
def initialize
  @short = :acme
  @input_format = :asciidoc
  @asciidoctor_backend = :acme
end

Public Instance Methods

extract_options(file) click to toggle source
Calls superclass method
# File lib/metanorma/acme/processor.rb, line 28
def extract_options(file)
  head = file.sub(/\n\n.*$/m, "\n")
  /\n:htmlstylesheet: (?<htmlstylesheet>[^\n]+)\n/ =~ head
  /\n:htmlcoverpage: (?<htmlcoverpage>[^\n]+)\n/ =~ head
  /\n:htmlintropage: (?<htmlintropage>[^\n]+)\n/ =~ head
  /\n:scripts: (?<scripts>[^\n]+)\n/ =~ head
  /\n:wordstylesheet: (?<wordstylesheet>[^\n]+)\n/ =~ head
  /\n:standardstylesheet: (?<standardstylesheet>[^\n]+)\n/ =~ head
  /\n:header: (?<header>[^\n]+)\n/ =~ head
  /\n:wordcoverpage: (?<wordcoverpage>[^\n]+)\n/ =~ head
  /\n:wordintropage: (?<wordintropage>[^\n]+)\n/ =~ head
  /\n:ulstyle: (?<ulstyle>[^\n]+)\n/ =~ head
  /\n:olstyle: (?<olstyle>[^\n]+)\n/ =~ head
  new_options = {
    htmlstylesheet: defined?(htmlstylesheet) ? htmlstylesheet : nil,
    htmlcoverpage: defined?(htmlcoverpage) ? htmlcoverpage : nil,
    htmlintropage: defined?(htmlintropage) ? htmlintropage : nil,
    scripts: defined?(scripts) ? scripts : nil,
    wordstylesheet: defined?(wordstylesheet) ? wordstylesheet : nil,
    standardstylesheet: defined?(standardstylesheet) ? standardstylesheet : nil,
    header: defined?(header) ? header : nil,
    wordcoverpage: defined?(wordcoverpage) ? wordcoverpage : nil,
    wordintropage: defined?(wordintropage) ? wordintropage : nil,
    ulstyle: defined?(ulstyle) ? ulstyle : nil,
    olstyle: defined?(olstyle) ? olstyle : nil,
  }.reject { |_, val| val.nil? }
  super.merge(new_options)
end
input_to_isodoc(file, filename) click to toggle source
# File lib/metanorma/acme/processor.rb, line 24
def input_to_isodoc(file, filename)
  Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
end
output(isodoc_node, outname, format, options={}) click to toggle source
Calls superclass method
# File lib/metanorma/acme/processor.rb, line 57
def output(isodoc_node, outname, format, options={})
  case format
  when :html
    IsoDoc::Acme::HtmlConvert.new(options).convert(outname, isodoc_node)
  when :doc
    IsoDoc::Acme::WordConvert.new(options).convert(outname, isodoc_node)
  when :pdf
    IsoDoc::Acme::PdfConvert.new(options).convert(outname, isodoc_node)
  else
    super
  end
end
output_formats() click to toggle source
Calls superclass method
# File lib/metanorma/acme/processor.rb, line 12
def output_formats
  super.merge(
    html: "html",
    doc: "doc",
    pdf: "pdf"
  )
end
version() click to toggle source
# File lib/metanorma/acme/processor.rb, line 20
def version
  "Metanorma::Acme #{Metanorma::Acme::VERSION}"
end