convert_attrs_matching_word_pairs

in lib/rdoc/markup/attribute_manager.rb [146:173]


  def convert_attrs_matching_word_pairs(str, attrs, exclusive)
    
    tags = @matching_word_pairs.select { |start, bitmap|
      if exclusive && exclusive?(bitmap)
        true
      elsif !exclusive && !exclusive?(bitmap)
        true
      else
        false
      end
    }.keys
    return if tags.empty?
    all_tags = @matching_word_pairs.keys

    re = /(^|\W|[

    1 while str.gsub!(re) { |orig|
      attr = @matching_word_pairs[$2]
      attr_updated = attrs.set_attrs($`.length + $1.length + $2.length, $3.length, attr)
      if attr_updated
        $1 + NULL * $2.length + $3 + NULL * $2.length + $4
      else
        $1 + NON_PRINTING_START + $2 + NON_PRINTING_END + $3 + NON_PRINTING_START + $2 + NON_PRINTING_END + $4
      end
    }
    str.delete!(NON_PRINTING_START + NON_PRINTING_END)
  end