Sha256: b992c4ec3b9cd7189f2a95014f731a6ca5e36acfea06f9f55fa5314e61646aca

Contents?: true

Size: 770 Bytes

Versions: 3

Compression:

Stored size: 770 Bytes

Contents

# frozen_string_literal: true

module Metanorma
  module Plugin
    module Lutaml
      class LutamlTableInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
        include LutamlDiagramBase
        SUPPORTED_OPTIONS = %w[class enum data_type]

        use_dsl
        named :lutaml_table_class

        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}"></xref>)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
metanorma-plugin-lutaml-0.4.11 lib/metanorma/plugin/lutaml/lutaml_table_inline_macro.rb
metanorma-plugin-lutaml-0.4.10 lib/metanorma/plugin/lutaml/lutaml_table_inline_macro.rb
metanorma-plugin-lutaml-0.4.9 lib/metanorma/plugin/lutaml/lutaml_table_inline_macro.rb