Class: Metanorma::Plugin::Plantuml::BlockProcessor

Inherits:
Asciidoctor::Extensions::BlockProcessor
  • Object
show all
Includes:
BlockProcessorBase
Defined in:
lib/metanorma/plugin/plantuml/block_processor.rb

Overview

PlantUML block processor

Instance Method Summary collapse

Methods included from BlockProcessorBase

#abort

Instance Method Details

#process(parent, reader, attrs) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/metanorma/plugin/plantuml/block_processor.rb', line 14

def process(parent, reader, attrs)
  # Check for document-level disable flag
  if parent.document.attr("plantuml-disabled")
    return abort(parent, reader, attrs,
                 "PlantUML processing disabled")
  end

  # Check PlantUML availability explicitly
  unless Backend.plantuml_available?
    return abort(parent, reader, attrs,
                 "PlantUML not installed")
  end

  # Parse format specifications
  formats = parse_formats(attrs, parent.document)
  options = parse_options(parent, reader, attrs)

  process_image_block(parent, reader, attrs, formats, options)
rescue StandardError => e
  abort(parent, reader, attrs, e.message)
end