Sha256: 2a6d3d2c788753376cdf2d6f3af2295d8c094080c54e85f30430b3e78dc3d6d4

Contents?: true

Size: 589 Bytes

Versions: 5

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true

module Stepmod
  module Utils
    module Converters
      class Em < ReverseAsciidoctor::Converters::Base
        def convert(node, state = {})
          content = treat_children(node, state.merge(already_italic: true))
          if content.strip.empty? || state[:already_italic]
            content
          else
            "#{content[/^\s*/]}_#{content.strip}_#{content[/\s*$/]}"
          end
        end
      end

      ReverseAsciidoctor::Converters.register :em, Em.new
      ReverseAsciidoctor::Converters.register :cite,  Em.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/em.rb
stepmod-utils-0.1.4 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.1.3 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.1.2 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.1.1 lib/stepmod/utils/converters/em.rb