Outputs RDoc markup with hot backspace action! You will probably need a pager to use this output format.

This formatter won't work on 1.8.6 because it lacks String#chars.

Methods
A
C
I
N
Class Public methods
new(markup = nil)

Returns a new ToBs that is ready for hot backspace action!

# File ../ruby/lib/rdoc/markup/to_bs.rb, line 14
def initialize markup = nil
  super

  @in_b  = false
  @in_em = false
end
Instance Public methods
accept_heading(heading)

Makes heading text bold.

# File ../ruby/lib/rdoc/markup/to_bs.rb, line 34
def accept_heading heading
  use_prefix or @res << ' ' * @indent
  @res << @headings[heading.level][0]
  @in_b = true
  @res << attributes(heading.text)
  @in_b = false
  @res << @headings[heading.level][1]
  @res << "\n"
end
annotate(tag)

Turns on or off special handling for convert_string

# File ../ruby/lib/rdoc/markup/to_bs.rb, line 47
def annotate tag
  case tag
  when '+b' then @in_b = true
  when '-b' then @in_b = false
  when '+_' then @in_em = true
  when '-_' then @in_em = false
  end
  ''
end
convert_special(special)

Calls #convert_string on the result of #convert_special

# File ../ruby/lib/rdoc/markup/to_bs.rb, line 60
def convert_special special
  convert_string super
end
convert_string(string)

Adds bold or underline mixed with backspaces

# File ../ruby/lib/rdoc/markup/to_bs.rb, line 67
def convert_string string
  return string unless string.respond_to? :chars # your ruby is lame
  return string unless @in_b or @in_em
  chars = if @in_b then
            string.chars.map do |char| "#{char}\b#{char}" end
          elsif @in_em then
            string.chars.map do |char| "_\b#{char}" end
          end

  chars.join
end
init_tags()

Sets a flag that is picked up by annotate to do the right thing in convert_string

# File ../ruby/lib/rdoc/markup/to_bs.rb, line 25
def init_tags
  add_tag :BOLD, '+b', '-b'
  add_tag :EM,   '+_', '-_'
  add_tag :TT,   ''  , ''   # we need in_tt information maintained
end