Sha256: 95c68b678dc6f7894efd1f25e8368eeaddf64959a1f0d415d70b0d4b80cb8df5

Contents?: true

Size: 862 Bytes

Versions: 12

Compression:

Stored size: 862 Bytes

Contents

# frozen_string_literal: true

module Stepmod
  module Utils
    module Converters
      class ModuleRef < ReverseAdoc::Converters::Base
        def convert(node, _state = {})
          ref = node['linkend']
          # #23:
          # In this case when we see this:

          # <module_ref linkend="product_as_individual:3_definition">individual products</module_ref>
          # We take the text value of the element and convert to this:

          # term:[individual products]
          if node['linkend'].split(':').length > 1
            ref = node.text
          end
          " term:[#{normalized_ref(ref)}] "
        end

        private

        def normalized_ref(ref)
          return unless ref || ref.empty?

          ref.squeeze(' ').strip
        end
      end
      ReverseAdoc::Converters.register :module_ref, ModuleRef.new
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
stepmod-utils-0.3.2 lib/stepmod/utils/converters/module_ref.rb
stepmod-utils-0.3.1 lib/stepmod/utils/converters/module_ref.rb
stepmod-utils-0.3.0 lib/stepmod/utils/converters/module_ref.rb
stepmod-utils-0.2.7 lib/stepmod/utils/converters/module_ref.rb
stepmod-utils-0.2.6 lib/stepmod/utils/converters/module_ref.rb
stepmod-utils-0.2.5 lib/stepmod/utils/converters/module_ref.rb
stepmod-utils-0.2.4 lib/stepmod/utils/converters/module_ref.rb
stepmod-utils-0.2.3 lib/stepmod/utils/converters/module_ref.rb
stepmod-utils-0.2.0 lib/stepmod/utils/converters/module_ref.rb
stepmod-utils-0.1.8 lib/stepmod/utils/converters/module_ref.rb
stepmod-utils-0.1.7 lib/stepmod/utils/converters/module_ref.rb
stepmod-utils-0.1.6 lib/stepmod/utils/converters/module_ref.rb