ruby-changes:54245
From: aycabta <ko1@a...>
Date: Thu, 20 Dec 2018 13:57:14 +0900 (JST)
Subject: [ruby-changes:54245] aycabta:r65106 (trunk): Merge rdoc-6.1.0.beta2
aycabta 2018-10-17 15:28:20 +0900 (Wed, 17 Oct 2018) New Revision: 65106 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65106 Log: Merge rdoc-6.1.0.beta2 Added files: trunk/lib/rdoc/markup/regexp_handling.rb Removed files: trunk/lib/rdoc/markup/inline.rb trunk/lib/rdoc/markup/special.rb Modified files: trunk/lib/rdoc/cross_reference.rb trunk/lib/rdoc/markup/attribute_manager.rb trunk/lib/rdoc/markup/attributes.rb trunk/lib/rdoc/markup/formatter.rb trunk/lib/rdoc/markup/heading.rb trunk/lib/rdoc/markup/to_bs.rb trunk/lib/rdoc/markup/to_html.rb trunk/lib/rdoc/markup/to_html_crossref.rb trunk/lib/rdoc/markup/to_html_snippet.rb trunk/lib/rdoc/markup/to_label.rb trunk/lib/rdoc/markup/to_markdown.rb trunk/lib/rdoc/markup/to_rdoc.rb trunk/lib/rdoc/markup/to_tt_only.rb trunk/lib/rdoc/markup.rb trunk/lib/rdoc/parser/ripper_state_lex.rb trunk/lib/rdoc/parser/ruby.rb trunk/lib/rdoc/parser/ruby_tools.rb trunk/lib/rdoc/rd/block_parser.rb trunk/lib/rdoc/rd/inline_parser.rb trunk/lib/rdoc/rdoc.gemspec trunk/lib/rdoc/rdoc.rb trunk/lib/rdoc/store.rb trunk/lib/rdoc/top_level.rb trunk/lib/rdoc/version.rb trunk/test/rdoc/test_rdoc_cross_reference.rb trunk/test/rdoc/test_rdoc_markup_attribute_manager.rb trunk/test/rdoc/test_rdoc_markup_attributes.rb trunk/test/rdoc/test_rdoc_markup_formatter.rb trunk/test/rdoc/test_rdoc_markup_to_html.rb trunk/test/rdoc/test_rdoc_markup_to_html_crossref.rb trunk/test/rdoc/test_rdoc_markup_to_html_snippet.rb trunk/test/rdoc/test_rdoc_parser_ruby.rb trunk/test/rdoc/test_rdoc_servlet.rb trunk/test/rdoc/test_rdoc_store.rb trunk/test/rdoc/test_rdoc_text.rb Index: lib/rdoc/markup/inline.rb =================================================================== --- lib/rdoc/markup/inline.rb (revision 65105) +++ lib/rdoc/markup/inline.rb (nonexistent) @@ -1,2 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/inline.rb#L0 -# frozen_string_literal: true -warn "requiring rdoc/markup/inline is deprecated and will be removed in RDoc 4." if $-w Property changes on: lib/rdoc/markup/inline.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Index: lib/rdoc/markup/special.rb =================================================================== --- lib/rdoc/markup/special.rb (revision 65105) +++ lib/rdoc/markup/special.rb (nonexistent) @@ -1,41 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/special.rb#L0 -# frozen_string_literal: true -## -# Hold details of a special sequence - -class RDoc::Markup::Special - - ## - # Special type - - attr_reader :type - - ## - # Special text - - attr_accessor :text - - ## - # Creates a new special sequence of +type+ with +text+ - - def initialize(type, text) - @type, @text = type, text - end - - ## - # Specials are equal when the have the same text and type - - def ==(o) - self.text == o.text && self.type == o.type - end - - def inspect # :nodoc: - "#<RDoc::Markup::Special:0x%x @type=%p, @text=%p>" % [ - object_id, @type, text.dump] - end - - def to_s # :nodoc: - "Special: type=#{type} text=#{text.dump}" - end - -end - Property changes on: lib/rdoc/markup/special.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Index: lib/rdoc/markup/to_html.rb =================================================================== --- lib/rdoc/markup/to_html.rb (revision 65105) +++ lib/rdoc/markup/to_html.rb (revision 65106) @@ -53,18 +53,18 @@ class RDoc::Markup::ToHtml < RDoc::Marku https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html.rb#L53 @hard_break = "<br>\n" # external links - @markup.add_special(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/, - :HYPERLINK) + @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/, + :HYPERLINK) - add_special_RDOCLINK - add_special_TIDYLINK + add_regexp_handling_RDOCLINK + add_regexp_handling_TIDYLINK init_tags end - # :section: Special Handling + # :section: Regexp Handling # - # These methods handle special markup added by RDoc::Markup#add_special. + # These methods are used by regexp handling markup added by RDoc::Markup#add_regexp_handling. def handle_RDOCLINK url # :nodoc: case url @@ -91,14 +91,14 @@ class RDoc::Markup::ToHtml < RDoc::Marku https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html.rb#L91 end ## - # +special+ is a <code><br></code> + # +target+ is a <code><br></code> - def handle_special_HARD_BREAK special + def handle_regexp_HARD_BREAK target '<br>' end ## - # +special+ is a potential link. The following schemes are handled: + # +target+ is a potential link. The following schemes are handled: # # <tt>mailto:</tt>:: # Inserted as-is. @@ -109,14 +109,14 @@ class RDoc::Markup::ToHtml < RDoc::Marku https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html.rb#L109 # <tt>link:</tt>:: # Reference to a local file relative to the output directory. - def handle_special_HYPERLINK(special) - url = special.text + def handle_regexp_HYPERLINK(target) + url = target.text gen_url url, url end ## - # +special+ is an rdoc-schemed link that will be converted into a hyperlink. + # +target+ is an rdoc-schemed link that will be converted into a hyperlink. # # For the +rdoc-ref+ scheme the named reference will be returned without # creating a link. @@ -124,16 +124,16 @@ class RDoc::Markup::ToHtml < RDoc::Marku https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html.rb#L124 # For the +rdoc-label+ scheme the footnote and label prefixes are stripped # when creating a link. All other contents will be linked verbatim. - def handle_special_RDOCLINK special - handle_RDOCLINK special.text + def handle_regexp_RDOCLINK target + handle_RDOCLINK target.text end ## - # This +special+ is a link where the label is different from the URL + # This +target+ is a link where the label is different from the URL # <tt>label[url]</tt> or <tt>{long label}[url]</tt> - def handle_special_TIDYLINK(special) - text = special.text + def handle_regexp_TIDYLINK(target) + text = target.text return text unless text =~ /^\{(.*)\}\[(.*?)\]$/ or text =~ /^(\S+)\[(.*?)\]$/ @@ -186,7 +186,7 @@ class RDoc::Markup::ToHtml < RDoc::Marku https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html.rb#L186 @res << "\n<p>" text = paragraph.text @hard_break text = text.gsub(/\r?\n/, ' ') - @res << wrap(to_html(text)) + @res << to_html(text) @res << "</p>\n" end @@ -312,7 +312,7 @@ class RDoc::Markup::ToHtml < RDoc::Marku https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html.rb#L312 ## # Generate a link to +url+ with content +text+. Handles the special cases - # for img: and link: described under handle_special_HYPERLINK + # for img: and link: described under handle_regexp_HYPERLINK def gen_url url, text scheme, url, id = parse_url url Index: lib/rdoc/markup/to_html_crossref.rb =================================================================== --- lib/rdoc/markup/to_html_crossref.rb (revision 65105) +++ lib/rdoc/markup/to_html_crossref.rb (revision 65106) @@ -40,7 +40,7 @@ class RDoc::Markup::ToHtmlCrossref < RDo https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html_crossref.rb#L40 @show_hash = @options.show_hash crossref_re = @hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP - @markup.add_special crossref_re, :CROSSREF + @markup.add_regexp_handling crossref_re, :CROSSREF @cross_reference = RDoc::CrossReference.new @context end @@ -68,8 +68,8 @@ class RDoc::Markup::ToHtmlCrossref < RDo https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html_crossref.rb#L68 # example, ToHtml is found, even without the <tt>RDoc::Markup::</tt> prefix, # because we look for it in module Markup first. - def handle_special_CROSSREF(special) - name = special.text + def handle_regexp_CROSSREF(target) + name = target.text return name if name =~ /@[\w-]+\.[\w-]/ # labels that look like emails @@ -87,22 +87,22 @@ class RDoc::Markup::ToHtmlCrossref < RDo https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html_crossref.rb#L87 # Handles <tt>rdoc-ref:</tt> scheme links and allows RDoc::Markup::ToHtml to # handle other schemes. - def handle_special_HYPERLINK special - return cross_reference $' if special.text =~ /\Ardoc-ref:/ + def handle_regexp_HYPERLINK target + return cross_reference $' if target.text =~ /\Ardoc-ref:/ super end ## - # +special+ is an rdoc-schemed link that will be converted into a hyperlink. + # +target+ is an rdoc-schemed link that will be converted into a hyperlink. # For the rdoc-ref scheme the cross-reference will be looked up and the # given name will be used. # # All other contents are handled by - # {the superclass}[rdoc-ref:RDoc::Markup::ToHtml#handle_special_RDOCLINK] + # {the superclass}[rdoc-ref:RDoc::Markup::ToHtml#handle_regexp_RDOCLINK] - def handle_special_RDOCLINK special - url = special.text + def handle_regexp_RDOCLINK target + url = target.text case url when /\Ardoc-ref:/ then @@ -126,8 +126,6 @@ class RDoc::Markup::ToHtmlCrossref < RDo https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_html_crossref.rb#L126 # Creates an HTML link to +name+ with the given +text+. def link name, text - original_name = name - if name =~ /(.*[^#:])@/ then name = $1 label = $' Index: lib/rdoc/markup/to_rdoc.rb =================================================================== --- lib/rdoc/markup/to_rdoc.rb (revision 65105) +++ lib/rdoc/markup/to_rdoc.rb (revision 65106) @@ -45,7 +45,7 @@ class RDoc::Markup::ToRdoc < RDoc::Marku https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_rdoc.rb#L45 def initialize markup = nil super nil, markup - @markup.add_special(/\\\S/, :SUPPRESSED_CROSSREF) + @markup.add_regexp_handling(/\\\S/, :SUPPRESSED_CROSSREF) @width = 78 init_tags @@ -253,10 +253,10 @@ class RDoc::Markup::ToRdoc < RDoc::Marku https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_rdoc.rb#L253 end ## - # Removes preceding \\ from the suppressed crossref +special+ + # Removes preceding \\ from the suppressed crossref +target+ - def handle_special_SUPPRESSED_CROSSREF special - text = special.text + def handle_regexp_SUPPRESSED_CROSSREF target + text = target.text text = text.sub('\\', '') unless in_tt? text end @@ -264,7 +264,7 @@ class RDoc::Markup::ToRdoc < RDoc::Marku https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_rdoc.rb#L264 ## # Adds a newline to the output - def handle_special_HARD_BREAK special + def handle_regexp_HARD_BREAK target "\n" end Index: lib/rdoc/markup/formatter.rb =================================================================== --- lib/rdoc/markup/formatter.rb (revision 65105) +++ lib/rdoc/markup/formatter.rb (revision 65106) @@ -50,7 +50,7 @@ class RDoc::Markup::Formatter https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/formatter.rb#L50 @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 https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/formatter.rb#L78 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 https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/formatter.rb#L134 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 https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/formatter.rb#L145 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 ## Index: lib/rdoc/markup/to_label.rb =================================================================== --- lib/rdoc/markup/to_label.rb (revision 65105) +++ lib/rdoc/markup/to_label.rb (revision 65106) @@ -16,8 +16,8 @@ class RDoc::Markup::ToLabel < RDoc::Mark https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_label.rb#L16 def initialize markup = nil super nil, markup - @markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF - @markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\])/, :TIDYLINK) + @markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF + @markup.add_regexp_handling(/(((\{.*?\})|\b\S+?)\[\S+?\])/, :TIDYLINK) add_tag :BOLD, '', '' add_tag :TT, '', '' @@ -36,20 +36,20 @@ class RDoc::Markup::ToLabel < RDoc::Mark https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_label.rb#L36 end ## - # Converts the CROSSREF +special+ to plain text, removing the suppression + # Converts the CROSSREF +target+ to plain text, removing the suppression # marker, if any - def handle_special_CROSSREF special - text = special.text + def handle_regexp_CROSSREF target + text = target.text text.sub(/^\\/, '') end ## - # Converts the TIDYLINK +special+ to just the text part + # Converts the TIDYLINK +target+ to just the text part - def handle_special_TIDYLINK special - text = special.text + def handle_regexp_TIDYLINK target + text = target.text return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/ @@ -68,7 +68,7 @@ class RDoc::Markup::ToLabel < RDoc::Mark https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markup/to_label.rb#L68 alias accept_rule ignore alias accept_verbatim ignore alias end_accepting ignore - alias handle_special_HARD_BREAK ignore + alias handle_regexp_HARD_BREAK ignore alias start_accepting ignore end Index: lib/rdoc/rd/block_parser.rb =================================================================== --- lib/rdoc/rd/block_parser.rb (revision 65105) +++ lib/rdoc/rd/block_parser.rb (revision 65106) @@ -420,52 +420,52 @@ end https://github.com/ruby/ruby/blob/trunk/lib/rdoc/rd/block_parser.rb#L420 racc_action_table = [ 34, 35, 30, 33, 40, 34, 35, 30, 33, 40, - 65, 34, 35, 30, 33, 14, 73, 14, 54, 76, - 15, 88, 34, 35, 30, 33, 14, 73, 77, 33, - 54, 15, 34, 35, 30, 33, 14, 73, 81, 38, - 38, 15, 34, 35, 30, 33, 14, 73, 40, 36, - 83, 15, 34, 35, 30, 33, 54, 47, 30, 35, - 34, 15, 34, 35, 30, 33, 14, 73, 38, 67, - 59, 15, 34, 35, 30, 33, 14, 9, 10, 11, - 12, 15, 34, 35, 30, 33, 14, 73, 14, nil, + 65, 34, 35, 30, 33, 14, 73, 36, 38, 34, + 15, 88, 34, 35, 30, 33, 14, 9, 10, 11, + 12, 15, 34, 35, 30, 33, 14, 9, 10, 11, + 12, 15, 34, 35, 30, 33, 35, 47, 30, 54, + 33, 15, 34, 35, 30, 33, 54, 47, 14, 14, + 59, 15, 34, 35, 30, 33, 14, 73, 67, 76, + 77, 15, 34, 35, 30, 33, 14, 73, 54, 81, + 38, 15, 34, 35, 30, 33, 14, 73, 38, 40, + 83, 15, 34, 35, 30, 33, 14, 73, nil, nil, nil, 15, 34, 35, 30, 33, 14, 73, nil, nil, - nil, 15, 34, 35, 30, 33, nil, 47, nil, nil, nil, 15, 34, 35, 30, 33, 14, 73, nil, nil, nil, 15, 34, 35, 30, 33, 14, 73, nil, nil, - nil, 15, 34, 35, 30, 33, 14, 9, 10, 11, - 12, 15, 34, 35, 30, 33, 14, 73, 61, 63, + nil, 15, 34, 35, 30, 33, 14, 73, nil, nil, + nil, 15, 34, 35, 30, 33, 14, 73, 61, 63, nil, 15, 14, 62, 60, 61, 63, 79, 61, 63, 62, 87, nil, 62, 34, 35, 30, 33 ] racc_action_check = [ 41, 41, 41, 41, 41, 15, 15, 15, 15, 15, - 41, 86, 86, 86, 86, 86, 86, 34, 33, 49, - 86, 86, 85, 85, 85, 85, 85, 85, 51, 31, - 54, 85, 79, 79, 79, 79, 79, 79, 56, 57, - 58, 79, 78, 78, 78, 78, 78, 78, 62, 1, - 66, 78, 24, 24, 24, 24, 30, 24, 28, 25, - 22, 24, 75, 75, 75, 75, 75, 75, 13, 44, - 36, 75, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 46, 46, 46, 46, 46, 46, 35, nil, - nil, 46, 45, 45, 45, 45, 45, 45, nil, nil, - nil, 45, 27, 27, 27, 27, nil, 27, nil, nil, - nil, 27, 74, 74, 74, 74, 74, 74, nil, nil, - nil, 74, 68, 68, 68, 68, 68, 68, nil, nil, - nil, 68, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 47, 47, 47, 47, 47, 47, 39, 39, - nil, 47, 52, 39, 39, 82, 82, 52, 64, 64, + 41, 86, 86, 86, 86, 86, 86, 1, 13, 22, + 86, 86, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 24, 24, 24, 24, 25, 24, 28, 30, + 31, 24, 27, 27, 27, 27, 33, 27, 34, 35, + 36, 27, 45, 45, 45, 45, 45, 45, 44, 49, + 51, 45, 46, 46, 46, 46, 46, 46, 54, 56, + 57, 46, 47, 47, 47, 47, 47, 47, 58, 62, + 66, 47, 68, 68, 68, 68, 68, 68, nil, nil, + nil, 68, 74, 74, 74, 74, 74, 74, nil, nil, + nil, 74, 75, 75, 75, 75, 75, 75, nil, nil, + nil, 75, 78, 78, 78, 78, 78, 78, nil, nil, + nil, 78, 79, 79, 79, 79, 79, 79, nil, nil, + nil, 79, 85, 85, 85, 85, 85, 85, 39, 39, + nil, 85, 52, 39, 39, 82, 82, 52, 64, 64, 82, 82, nil, 64, 20, 20, 20, 20 ] racc_action_pointer = [ - 129, 49, 69, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, 61, nil, 2, nil, nil, nil, nil, - 161, nil, 57, nil, 49, 55, nil, 99, 53, nil, - 48, 23, nil, 10, 10, 81, 70, nil, nil, 141, - nil, -3, nil, nil, 56, 89, 79, 139, nil, 6, - nil, 15, 145, nil, 22, nil, 25, 32, 33, nil, (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/