Class: Metanorma::Plugin::Lutaml::LutamlEaDiagramBlockMacro

Inherits:
Asciidoctor::Extensions::BlockMacroProcessor
  • Object
show all
Includes:
LutamlDiagramBase
Defined in:
lib/metanorma/plugin/lutaml/lutaml_ea_diagram_block_macro.rb

Instance Method Summary collapse

Methods included from LutamlDiagramBase

#lutaml_file

Instance Method Details

#process(parent, _target, attrs) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/metanorma/plugin/lutaml/lutaml_ea_diagram_block_macro.rb', line 14

def process(parent, _target, attrs)
  orig_doc = parent.document.attributes["lutaml_xmi_cache"]
    .values.first.original_document
  diagram = fetch_diagram_by_name(orig_doc, attrs["name"])
  return if diagram.nil?

  through_attrs = generate_attrs(attrs)
  through_attrs["target"] =
    img_src_path(parent.document, attrs, diagram)
  through_attrs["title"] = diagram.name

  create_image_block(parent, through_attrs)
end