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.
Returns a new ToBs that is ready for hot backspace action!
# File rdoc/markup/to_bs.rb, line 12 def initialize markup = nil super @in_b = false @in_em = false end
Makes heading text bold.
# File rdoc/markup/to_bs.rb, line 32 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
Turns on or off regexp handling for convert_string
# File rdoc/markup/to_bs.rb, line 45 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
Calls #convert_string on the result of #convert_regexp_handling
# File rdoc/markup/to_bs.rb, line 58 def convert_regexp_handling target convert_string super end
Adds bold or underline mixed with backspaces
# File rdoc/markup/to_bs.rb, line 65 def convert_string string 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