Sha256: 0465d8e62f9ed5ce7a6a5e14714371cf1c1c521a6fda1faa92e66470578c754d

Contents?: true

Size: 570 Bytes

Versions: 13

Compression:

Stored size: 570 Bytes

Contents

# frozen_string_literal: true

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

13 entries across 13 versions & 1 rubygems

Version Path
stepmod-utils-0.6.6 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.6.5 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.6.3 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.6.2 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.6.1 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.6.0 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.5.0 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.4.14 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.4.13 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.4.12 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.4.11 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.4.10 lib/stepmod/utils/converters/em.rb
stepmod-utils-0.4.9 lib/stepmod/utils/converters/em.rb