Sha256: dffe9fe4c9b55b6bfeed50f0ae1f93cc8b1f4e8f79d4aa26d4de5bedee2b76c2

Contents?: true

Size: 764 Bytes

Versions: 4

Compression:

Stored size: 764 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

        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

4 entries across 4 versions & 1 rubygems

Version Path
metanorma-plugin-lutaml-0.4.15 lib/metanorma/plugin/lutaml/lutaml_table_inline_macro.rb
metanorma-plugin-lutaml-0.4.14 lib/metanorma/plugin/lutaml/lutaml_table_inline_macro.rb
metanorma-plugin-lutaml-0.4.13 lib/metanorma/plugin/lutaml/lutaml_table_inline_macro.rb
metanorma-plugin-lutaml-0.4.12 lib/metanorma/plugin/lutaml/lutaml_table_inline_macro.rb