Sha256: 5c1dd0b9d952cf6b49fd8db5269d9ba4db109c82e3fbe84386e068a0fae0cf98

Contents?: true

Size: 619 Bytes

Versions: 10

Compression:

Stored size: 619 Bytes

Contents

# frozen_string_literal: true

module Stepmod
  module Utils
    module Converters
      class Em < ReverseAdoc::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

      ReverseAdoc::Converters.register :em, Em.new
      ReverseAdoc::Converters.register :i,  Em.new
      ReverseAdoc::Converters.register :cite,  Em.new
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
stepmod-utils-0.3.5 lib/stepmod/utils/converters/em_express_description.rb
stepmod-utils-0.3.4 lib/stepmod/utils/converters/em_express_description.rb
stepmod-utils-0.3.2 lib/stepmod/utils/converters/em_express_description.rb
stepmod-utils-0.3.1 lib/stepmod/utils/converters/em_express_description.rb
stepmod-utils-0.3.0 lib/stepmod/utils/converters/em_express_description.rb
stepmod-utils-0.2.7 lib/stepmod/utils/converters/em_express_description.rb
stepmod-utils-0.2.6 lib/stepmod/utils/converters/em_express_description.rb
stepmod-utils-0.2.5 lib/stepmod/utils/converters/em_express_description.rb
stepmod-utils-0.2.4 lib/stepmod/utils/converters/em_express_description.rb
stepmod-utils-0.2.3 lib/stepmod/utils/converters/em_express_description.rb