Class: Metanorma::Generic::Processor
- Inherits:
-
Processor
- Object
- Processor
- Metanorma::Generic::Processor
- Defined in:
- lib/metanorma/generic/processor.rb
Instance Method Summary collapse
- #configuration ⇒ Object
- #extract_options(file) ⇒ Object
- #fonts_manifest ⇒ Object
-
#initialize ⇒ Processor
constructor
rubocop:disable Lint/MissingSuper.
- #output(isodoc_node, inname, outname, format, options = {}) ⇒ Object
- #output_formats ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize ⇒ Processor
rubocop:disable Lint/MissingSuper
10 11 12 13 14 15 |
# File 'lib/metanorma/generic/processor.rb', line 10 def initialize # rubocop:disable Lint/MissingSuper n = configuration&.&.to_sym @short = n || :generic @input_format = :asciidoc @asciidoctor_backend = n || :generic end |
Instance Method Details
#configuration ⇒ Object
6 7 8 |
# File 'lib/metanorma/generic/processor.rb', line 6 def configuration Metanorma::Generic.configuration end |
#extract_options(file) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/metanorma/generic/processor.rb', line 29 def (file) head = file.sub(/\n\n.*$/m, "\n") ret = %w(htmlstylesheet htmlcoverpage htmlintropage scripts scripts-pdf wordstylesheet standardstylesheet header wordcoverpage wordintropage datauriimage htmltoclevels doctoclevels ulstyle olstyle htmlstylesheet-override sectionsplit wordstylesheet-override).each_with_object({}) do |w, acc| m = /\n:#{w}: ([^\n]+)\n/.match(head) or next acc[w.sub("-", "_").to_sym] = m[1] end super.merge(ret) end |
#fonts_manifest ⇒ Object
21 22 23 |
# File 'lib/metanorma/generic/processor.rb', line 21 def fonts_manifest configuration&.fonts_manifest end |
#output(isodoc_node, inname, outname, format, options = {}) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/metanorma/generic/processor.rb', line 42 def output(isodoc_node, inname, outname, format, = {}) () case format when :html IsoDoc::Generic::HtmlConvert.new() .convert(inname, isodoc_node, nil, outname) when :doc IsoDoc::Generic::WordConvert.new() .convert(inname, isodoc_node, nil, outname) when :presentation IsoDoc::Generic::PresentationXMLConvert.new() .convert(inname, isodoc_node, nil, outname) else super end end |
#output_formats ⇒ Object
17 18 19 |
# File 'lib/metanorma/generic/processor.rb', line 17 def output_formats configuration.formats end |