Class: Metanorma::Plugin::Lutaml::LutamlTableInlineMacro

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

Constant Summary collapse

SUPPORTED_OPTIONS =
%w[class enum data_type]

Instance Method Summary collapse

Methods included from LutamlDiagramBase

#lutaml_file

Instance Method Details

#process(parent, _target, attrs) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/metanorma/plugin/lutaml/lutaml_table_inline_macro.rb', line 13

def process(parent, _target, attrs)
  keyword = SUPPORTED_OPTIONS.find { |n| attrs[n] }
  entity_key = [keyword, attrs["package"], attrs[keyword]].compact.join(":")
  return if parent.document.attributes['lutaml_entity_id'].nil?
  xmi_id = parent.document.attributes['lutaml_entity_id'][entity_key]
  return unless xmi_id

  %Q(<xref target="section-#{xmi_id}"/>)
end