Class: Asciidoctor::Standoc::PlantUMLBlockMacro

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

Instance Method Summary collapse

Instance Method Details

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



81
82
83
84
85
# File 'lib/asciidoctor/standoc/macros_plantuml.rb', line 81

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



87
88
89
90
91
92
93
94
95
96
97
# File 'lib/asciidoctor/standoc/macros_plantuml.rb', line 87

def process(parent, reader, attrs)
  begin
    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
end