Sha256: 360f50fbfe7cfe6fdec97218b844c73ee851c079f7ab3a12552767f98939f785

Contents?: true

Size: 584 Bytes

Versions: 2

Compression:

Stored size: 584 Bytes

Contents

# frozen_string_literal: true

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

      ReverseAdoc::Converters.register :strong, Strong.new
      ReverseAdoc::Converters.register :b,      Strong.new
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stepmod-utils-0.2.4 lib/stepmod/utils/converters/strong.rb
stepmod-utils-0.2.3 lib/stepmod/utils/converters/strong.rb