diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-14 15:59:18 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-14 15:59:18 +0000 |
commit | 72113d58cd2fc62b3f4ef3d2eb6cec37393532a4 (patch) | |
tree | 534843caaea28f1171378c1ac5bea0184ed04054 /ruby_2_2/lib/rdoc/markup/to_bs.rb | |
parent | 1a74fa4b04da04bd2bb33103dd3cf431438df38e (diff) | |
parent | 02b8978ff10b05304dbb46d73b49a2cf3a87cb92 (diff) |
add tag v2_2_9v2_2_9
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v2_2_9@61259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby_2_2/lib/rdoc/markup/to_bs.rb')
-rw-r--r-- | ruby_2_2/lib/rdoc/markup/to_bs.rb | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/ruby_2_2/lib/rdoc/markup/to_bs.rb b/ruby_2_2/lib/rdoc/markup/to_bs.rb deleted file mode 100644 index 10c31854d2..0000000000 --- a/ruby_2_2/lib/rdoc/markup/to_bs.rb +++ /dev/null @@ -1,78 +0,0 @@ -## -# 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 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 - -end - |