class RDoc::Markup::AttributeManager

def convert_attrs(str, attrs)

def convert_attrs(str, attrs)
  # first do matching ones
  tags = @matching_word_pairs.keys.join("")
  re = /(^|\W)([#{tags}])([#\\]?[\w:.\/-]+?\S?)\2(\W|$)/
  1 while str.gsub!(re) do
    attr = @matching_word_pairs[$2]
    attrs.set_attrs($`.length + $1.length + $2.length, $3.length, attr)
    $1 + NULL * $2.length + $3 + NULL * $2.length + $4
  end
  # then non-matching
  unless @word_pair_map.empty? then
    @word_pair_map.each do |regexp, attr|
      str.gsub!(regexp) {
        attrs.set_attrs($`.length + $1.length, $2.length, attr)
        NULL * $1.length + $2 + NULL * $3.length
      }
    end
  end
end