convert_attrs(str, attrs)
public
Map attributes like textto the sequence
001002<char>001003<char>, where <char> is a per-attribute
specific character
# File lib/rdoc/markup/attribute_manager.rb, line 76
def convert_attrs(str, attrs)
# first do matching ones
tags = MATCHING_WORD_PAIRS.keys.join("")
re = /(^|\W)([#{tags}])([#:\\]?[\w.\/-]+?\S?)\22((\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