Class: Metanorma::Acme::Processor
- Inherits:
-
Processor
- Object
- Processor
- Metanorma::Acme::Processor
- Defined in:
- lib/metanorma/acme/processor.rb
Instance Method Summary collapse
- #extract_options(file) ⇒ Object
-
#initialize ⇒ Processor
constructor
A new instance of Processor.
- #input_to_isodoc(file, filename) ⇒ Object
- #output(isodoc_node, outname, format, options = {}) ⇒ Object
- #output_formats ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize ⇒ Processor
Returns a new instance of Processor.
6 7 8 9 10 |
# File 'lib/metanorma/acme/processor.rb', line 6 def initialize @short = :acme @input_format = :asciidoc @asciidoctor_backend = :acme end |
Instance Method Details
#extract_options(file) ⇒ Object
28 29 30 31 32 33 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/acme/processor.rb', line 28 def (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 = { 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() end |
#input_to_isodoc(file, filename) ⇒ Object
24 25 26 |
# 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 = {}) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/metanorma/acme/processor.rb', line 57 def output(isodoc_node, outname, format, ={}) case format when :html IsoDoc::Acme::HtmlConvert.new().convert(outname, isodoc_node) when :doc IsoDoc::Acme::WordConvert.new().convert(outname, isodoc_node) when :pdf IsoDoc::Acme::PdfConvert.new().convert(outname, isodoc_node) else super end end |
#output_formats ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/metanorma/acme/processor.rb', line 12 def output_formats super.merge( html: "html", doc: "doc", pdf: "pdf" ) end |