Skip to content

Commit

Permalink
Merge rdoc-6.1.0.beta1.
Browse files Browse the repository at this point in the history
  * ruby/rdoc@v6.0.4...v6.1.0.beta1

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
hsbt committed Aug 27, 2018
1 parent 41fb243 commit 95e213d
Show file tree
Hide file tree
Showing 22 changed files with 576 additions and 194 deletions.
6 changes: 1 addition & 5 deletions lib/rdoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ module RDoc

class Error < RuntimeError; end

##
# RDoc version you are using

VERSION = '6.0.4'
require 'rdoc/version'

##
# Method visibilities
Expand Down Expand Up @@ -146,7 +143,6 @@ def self.load_yaml

autoload :KNOWN_CLASSES, 'rdoc/known_classes'

autoload :RipperStateLex, 'rdoc/parser/ripper_state_lex'
autoload :TokenStream, 'rdoc/token_stream'

autoload :Comment, 'rdoc/comment'
Expand Down
36 changes: 27 additions & 9 deletions lib/rdoc/cross_reference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RDoc::CrossReference
#
# See CLASS_REGEXP_STR

METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>)(?:\([\w.+*/=<>-]*\))?'
METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>|-|\+|\*)(?:\([\w.+*/=<>-]*\))?'

##
# Regular expressions matching text that should potentially have
Expand Down Expand Up @@ -127,23 +127,41 @@ def resolve name, text

if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then
type = $2
type = '' if type == '.' # will find either #method or ::method
method = "#{type}#{$3}"
if '.' == type # will find either #method or ::method
method = $3
else
method = "#{type}#{$3}"
end
container = @context.find_symbol_module($1)
elsif /^([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then
type = $1
type = '' if type == '.'
method = "#{type}#{$2}"
if '.' == type
method = $2
else
method = "#{type}#{$2}"
end
container = @context
else
type = nil
container = nil
end

if container then
ref = container.find_local_symbol method

unless ref || RDoc::TopLevel === container then
ref = container.find_ancestor_local_symbol method
unless RDoc::TopLevel === container then
if '.' == type then
if 'new' == method then # AnyClassName.new will be class method
ref = container.find_local_symbol method
ref = container.find_ancestor_local_symbol method unless ref
else
ref = container.find_local_symbol "::#{method}"
ref = container.find_ancestor_local_symbol "::#{method}" unless ref
ref = container.find_local_symbol "##{method}" unless ref
ref = container.find_ancestor_local_symbol "##{method}" unless ref
end
else
ref = container.find_local_symbol method
ref = container.find_ancestor_local_symbol method unless ref
end
end
end

Expand Down
14 changes: 2 additions & 12 deletions lib/rdoc/generator/markup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ class RDoc::CodeObject

class RDoc::MethodAttr

@add_line_numbers = false

class << self
##
# Allows controlling whether <tt>#markup_code</tt> adds line numbers to
# the source code.

attr_accessor :add_line_numbers
end

##
# Prepend +src+ with line numbers. Relies on the first line of a source
# code listing having:
Expand Down Expand Up @@ -106,7 +96,7 @@ def add_line_numbers(src)
##
# Turns the method's token stream into HTML.
#
# Prepends line numbers if +add_line_numbers+ is true.
# Prepends line numbers if +options.line_numbers+ is true.

def markup_code
return '' unless @token_stream
Expand All @@ -126,7 +116,7 @@ def markup_code
end
src.gsub!(/^#{' ' * indent}/, '') if indent > 0

add_line_numbers(src) if RDoc::MethodAttr.add_line_numbers
add_line_numbers(src) if options.line_numbers

src
end
Expand Down
7 changes: 3 additions & 4 deletions lib/rdoc/generator/template/json_index/js/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ Navigation = new function() {
}
break;
case 13: //Event.KEY_RETURN:
if (this.$current)
e.preventDefault();
this.select(this.$current);
if (this.$current) e.preventDefault();
this.select(this.$current);
break;
}
if (e.ctrlKey && e.shiftKey) this.select(this.$current);
Expand All @@ -80,7 +79,7 @@ Navigation = new function() {
var go = function() {
if (!_this.moveTimeout) return;
_this[isDown ? 'moveDown' : 'moveUp']();
_this.moveTimout = setTimeout(go, 100);
_this.moveTimeout = setTimeout(go, 100);
}
this.moveTimeout = setTimeout(go, 200);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rdoc/markup/to_html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def accept_verbatim verbatim

content = if verbatim.ruby? or parseable? text then
begin
tokens = RDoc::RipperStateLex.parse text
tokens = RDoc::Parser::RipperStateLex.parse text
klass = ' class="ruby"'

result = RDoc::TokenStream.to_html tokens
Expand Down
3 changes: 0 additions & 3 deletions lib/rdoc/markup/to_html_crossref.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ def link name, text

ref = @cross_reference.resolve name, text

text = ref.output_name @context if
RDoc::MethodAttr === ref and text == original_name

case ref
when String then
ref
Expand Down
Loading

0 comments on commit 95e213d

Please sign in to comment.