Class: RI::OverstrikeFormatter

Inherits:
AttributeFormatter show all
Defined in:
lib/rdoc/ri/ri_formatter.rb

Overview

This formatter generates overstrike-style formatting, which works with pagers such as man and less.

Constant Summary collapse

BS =
"\C-h"

Constants inherited from AttributeFormatter

AttributeFormatter::ATTR_MAP, AttributeFormatter::BOLD, AttributeFormatter::CODE, AttributeFormatter::ITALIC

Constants inherited from TextFormatter

TextFormatter::FORMATTERS

Instance Attribute Summary

Attributes inherited from TextFormatter

#indent

Instance Method Summary collapse

Methods inherited from AttributeFormatter

#wrap

Methods inherited from TextFormatter

#blankline, #break_to_newline, #conv_html, #conv_markup, #display_flow, #display_flow_item, #display_heading, #display_list, #display_verbatim_flow_item, #draw_line, for, #initialize, list, #raw_print_line, #strip_attributes, #wrap

Constructor Details

This class inherits a constructor from RI::TextFormatter

Instance Method Details

#bold_print(text) ⇒ Object

draw a string in bold



390
391
392
393
394
# File 'lib/rdoc/ri/ri_formatter.rb', line 390

def bold_print(text)
  text.split(//).each do |ch|
    print ch, BS, ch
  end
end

#write_attribute_text(prefix, line) ⇒ Object



374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/rdoc/ri/ri_formatter.rb', line 374

def write_attribute_text(prefix, line)
  print prefix
  line.each do |achar|
    attr = achar.attr
    if (attr & (ITALIC+CODE)) != 0
      print "_", BS
    end
    if (attr & BOLD) != 0
      print achar.char, BS
    end
    print achar.char
  end
  puts
end