PATH:
opt
/
alt
/
ruby24
/
lib64
/
ruby
/
2.4.0
/
rdoc
/
markup
# frozen_string_literal: false ## # 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. class RDoc::Markup::ToBs < RDoc::Markup::ToRdoc ## # Returns a new ToBs that is ready for hot backspace action! def initialize markup = nil super @in_b = false @in_em = false end ## # Sets a flag that is picked up by #annotate to do the right thing in # #convert_string def init_tags add_tag :BOLD, '+b', '-b' add_tag :EM, '+_', '-_' add_tag :TT, '' , '' # we need in_tt information maintained end ## # Makes heading text bold. 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 special handling for +convert_string+ 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_special def convert_special special convert_string super end ## # Adds bold or underline mixed with backspaces 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 end
[-] list.rb
[edit]
[-] parser.rb
[edit]
[-] text_formatter_test_case.rb
[edit]
[-] list_item.rb
[edit]
[-] rule.rb
[edit]
[-] to_bs.rb
[edit]
[-] to_tt_only.rb
[edit]
[-] attributes.rb
[edit]
[-] paragraph.rb
[edit]
[-] raw.rb
[edit]
[-] heading.rb
[edit]
[-] formatter_test_case.rb
[edit]
[-] attribute_manager.rb
[edit]
[-] blank_line.rb
[edit]
[-] to_test.rb
[edit]
[-] attr_changer.rb
[edit]
[-] special.rb
[edit]
[-] to_table_of_contents.rb
[edit]
[-] to_html_crossref.rb
[edit]
[-] to_label.rb
[edit]
[-] indented_paragraph.rb
[edit]
[+]
..
[-] include.rb
[edit]
[-] hard_break.rb
[edit]
[-] document.rb
[edit]
[-] block_quote.rb
[edit]
[-] attr_span.rb
[edit]
[-] to_html.rb
[edit]
[-] to_joined_paragraph.rb
[edit]
[-] verbatim.rb
[edit]
[-] formatter.rb
[edit]
[-] to_html_snippet.rb
[edit]
[-] to_ansi.rb
[edit]
[-] pre_process.rb
[edit]
[-] to_markdown.rb
[edit]
[-] to_rdoc.rb
[edit]
[-] inline.rb
[edit]