Sha256: 4390987367051bafa7e6b69c96e54a6454686081b95c8af9c8664ac5b457bf16

Contents?: true

Size: 568 Bytes

Versions: 14

Compression:

Stored size: 568 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 :cite,  Em.new
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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