diff options
author | aycabta <aycabta@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-17 06:28:20 +0000 |
---|---|---|
committer | aycabta <aycabta@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-17 06:28:20 +0000 |
commit | 1b43644edc85a93bfc9228588c065c87f975cd93 (patch) | |
tree | ef3a60d0cbe73d15b39f6160853df9a23239a574 /lib/rdoc/markup/formatter.rb | |
parent | 2a59b579fed2fd49973ca73890f182299262909f (diff) |
Merge rdoc-6.1.0.beta2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/markup/formatter.rb')
-rw-r--r-- | lib/rdoc/markup/formatter.rb | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/lib/rdoc/markup/formatter.rb b/lib/rdoc/markup/formatter.rb index 5dc71d2242..6dff96c7d0 100644 --- a/lib/rdoc/markup/formatter.rb +++ b/lib/rdoc/markup/formatter.rb @@ -50,7 +50,7 @@ class RDoc::Markup::Formatter @markup = markup || RDoc::Markup.new @am = @markup.attribute_manager - @am.add_special(/<br>/, :HARD_BREAK) + @am.add_regexp_handling(/<br>/, :HARD_BREAK) @attributes = @am.attributes @@ -78,23 +78,24 @@ class RDoc::Markup::Formatter end ## - # Adds a special for links of the form rdoc-...: + # Adds a regexp handling for links of the form rdoc-...: - def add_special_RDOCLINK - @markup.add_special(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK) + def add_regexp_handling_RDOCLINK + @markup.add_regexp_handling(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK) end ## - # Adds a special for links of the form {<text>}[<url>] and <word>[<url>] + # Adds a regexp handling for links of the form {<text>}[<url>] and + # <word>[<url>] - def add_special_TIDYLINK - @markup.add_special(/(?: - \{.*?\} | # multi-word label - \b[^\s{}]+? # single-word label - ) + def add_regexp_handling_TIDYLINK + @markup.add_regexp_handling(/(?: + \{.*?\} | # multi-word label + \b[^\s{}]+? # single-word label + ) - \[\S+?\] # link target - /x, :TIDYLINK) + \[\S+?\] # link target + /x, :TIDYLINK) end ## @@ -133,8 +134,8 @@ class RDoc::Markup::Formatter when RDoc::Markup::AttrChanger then off_tags res, item on_tags res, item - when RDoc::Markup::Special then - res << convert_special(item) + when RDoc::Markup::RegexpHandling then + res << convert_regexp_handling(item) else raise "Unknown flow element: #{item.inspect}" end @@ -144,29 +145,29 @@ class RDoc::Markup::Formatter end ## - # Converts added specials. See RDoc::Markup#add_special + # Converts added regexp handlings. See RDoc::Markup#add_regexp_handling - def convert_special special - return special.text if in_tt? + def convert_regexp_handling target + return target.text if in_tt? handled = false - @attributes.each_name_of special.type do |name| - method_name = "handle_special_#{name}" + @attributes.each_name_of target.type do |name| + method_name = "handle_regexp_#{name}" if respond_to? method_name then - special.text = send method_name, special + target.text = send method_name, target handled = true end end unless handled then - special_name = @attributes.as_string special.type + target_name = @attributes.as_string target.type - raise RDoc::Error, "Unhandled special #{special_name}: #{special}" + raise RDoc::Error, "Unhandled regexp handling #{target_name}: #{target}" end - special.text + target.text end ## |