Method: RDoc::Markup::AttributeManager#add_word_pair
- Defined in:
- lib/rdoc/markup/attribute_manager.rb
#add_word_pair(start, stop, name, exclusive = false) ⇒ Object
Adds a markup class with name
for words wrapped in the start
and stop
character. To make words wrapped with “*” bold:
am.add_word_pair '*', '*', :BOLD
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/rdoc/markup/attribute_manager.rb', line 261 def add_word_pair(start, stop, name, exclusive = false) raise ArgumentError, "Word flags may not start with '<'" if start[0, 1] == '<' bitmap = @attributes.bitmap_for name if start == stop then @matching_word_pairs[start] = bitmap else pattern = /(#{Regexp.escape start})(\S+)(#{Regexp.escape stop})/ @word_pair_map[pattern] = bitmap end @protectable << start[0, 1] @protectable.uniq! @exclusive_bitmap |= bitmap if exclusive end |