Class: Metanorma::Standoc::PlantUMLBlockMacro

Inherits:
Asciidoctor::Extensions::BlockProcessor
  • Object
show all
Defined in:
lib/metanorma/standoc/macros_plantuml.rb

Instance Method Summary collapse

Instance Method Details

#abort(parent, reader, attrs, msg) ⇒ Object



108
109
110
111
112
113
# File 'lib/metanorma/standoc/macros_plantuml.rb', line 108

def abort(parent, reader, attrs, msg)
  warn msg
  attrs["language"] = "plantuml"
  create_listing_block parent, reader.source,
                       (attrs.reject { |k, _v| k == 1 })
end

#process(parent, reader, attrs) ⇒ Object



115
116
117
118
119
120
121
122
123
# File 'lib/metanorma/standoc/macros_plantuml.rb', line 115

def process(parent, reader, attrs)
  PlantUMLBlockMacroBackend.plantuml_installed?
  filename = PlantUMLBlockMacroBackend.generate_file(parent, reader)
  through_attrs = PlantUMLBlockMacroBackend.generate_attrs attrs
  through_attrs["target"] = filename
  create_image_block parent, through_attrs
rescue StandardError => e
  abort(parent, reader, attrs, e.message)
end