Sha256: 9e76dfc660173fcff6243b70dd53cc9c50f2bbd4236990bf3f5ac1bed0363cb2

Contents?: true

Size: 510 Bytes

Versions: 5

Compression:

Stored size: 510 Bytes

Contents

# frozen_string_literal: true

module Stepmod
  module Utils
    module Converters
      class ClauseRef < ReverseAsciidoctor::Converters::Base
        def convert(node, _state = {})
          " term:[#{normalized_ref(node['linkend'])}] "
        end

        private

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

          ref.to_s.split(':').last.squeeze(' ').strip
        end
      end
      ReverseAsciidoctor::Converters.register :clause_ref, ClauseRef.new
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stepmod-utils-0.1.5 lib/stepmod/utils/converters/clause_ref.rb
stepmod-utils-0.1.4 lib/stepmod/utils/converters/clause_ref.rb
stepmod-utils-0.1.3 lib/stepmod/utils/converters/clause_ref.rb
stepmod-utils-0.1.2 lib/stepmod/utils/converters/clause_ref.rb
stepmod-utils-0.1.1 lib/stepmod/utils/converters/clause_ref.rb