зеркало из https://github.com/github/ruby.git
Update rdoc-5.1.0
* Details of changes are following url. https://github.com/rdoc/rdoc/blob/master/History.rdoc#510--2017-02-24 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0f081edf7e
Коммит
df3e22ce84
|
@ -65,7 +65,7 @@ module RDoc
|
|||
##
|
||||
# RDoc version you are using
|
||||
|
||||
VERSION = '5.0.0'
|
||||
VERSION = '5.1.0'
|
||||
|
||||
##
|
||||
# Method visibilities
|
||||
|
|
|
@ -98,6 +98,11 @@ class RDoc::Context < RDoc::CodeObject
|
|||
|
||||
attr_accessor :visibility
|
||||
|
||||
##
|
||||
# Current visibility of this line
|
||||
|
||||
attr_writer :current_line_visibility
|
||||
|
||||
##
|
||||
# Hash of registered methods. Attributes are also registered here,
|
||||
# twice if they are RW.
|
||||
|
@ -148,6 +153,7 @@ class RDoc::Context < RDoc::CodeObject
|
|||
@extends = []
|
||||
@constants = []
|
||||
@external_aliases = []
|
||||
@current_line_visibility = nil
|
||||
|
||||
# This Hash maps a method name to a list of unmatched aliases (aliases of
|
||||
# a method not yet encountered).
|
||||
|
@ -478,7 +484,11 @@ class RDoc::Context < RDoc::CodeObject
|
|||
end
|
||||
else
|
||||
@methods_hash[key] = method
|
||||
method.visibility = @visibility
|
||||
if @current_line_visibility
|
||||
method.visibility, @current_line_visibility = @current_line_visibility, nil
|
||||
else
|
||||
method.visibility = @visibility
|
||||
end
|
||||
add_to @method_list, method
|
||||
resolve_aliases method
|
||||
end
|
||||
|
|
|
@ -170,7 +170,7 @@ class RDoc::Generator::JsonIndex
|
|||
outfile = out_dir + "#{search_index_file}.gz"
|
||||
|
||||
debug_msg "Reading the JSON index file from %s" % search_index_file
|
||||
search_index = search_index_file.read
|
||||
search_index = search_index_file.read(mode: 'r:utf-8')
|
||||
|
||||
debug_msg "Writing gzipped search index to %s" % outfile
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class RDoc::I18n::Locale
|
|||
end
|
||||
|
||||
##
|
||||
# Translates the +message+ into locale. If there is no tranlsation
|
||||
# Translates the +message+ into locale. If there is no translation
|
||||
# messages for +message+ in locale, +message+ itself is returned.
|
||||
|
||||
def translate(message)
|
||||
|
|
|
@ -78,7 +78,7 @@ class RDoc::Parser
|
|||
|
||||
return true if s[0, 2] == Marshal.dump('')[0, 2] or s.index("\x00")
|
||||
|
||||
mode = "r"
|
||||
mode = 'r:utf-8' # default source encoding has been chagened to utf-8
|
||||
s.sub!(/\A#!.*\n/, '') # assume shebang line isn't longer than 1024.
|
||||
encoding = s[/^\s*\#\s*(?:-\*-\s*)?(?:en)?coding:\s*([^\s;]+?)(?:-\*-|[\s;])/, 1]
|
||||
mode = "rb:#{encoding}" if encoding
|
||||
|
@ -180,7 +180,9 @@ class RDoc::Parser
|
|||
return nil if /coding:/i =~ type
|
||||
|
||||
type.downcase
|
||||
rescue ArgumentError # invalid byte sequence, etc.
|
||||
rescue ArgumentError
|
||||
rescue Encoding::InvalidByteSequenceError # invalid byte sequence
|
||||
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -1666,6 +1666,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
|
||||
unget_tk tk
|
||||
keep_comment = true
|
||||
container.current_line_visibility = nil
|
||||
|
||||
when TkCLASS then
|
||||
parse_class container, single, tk, comment
|
||||
|
@ -1888,6 +1889,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
|
|||
#
|
||||
when TkNL, TkUNLESS_MOD, TkIF_MOD, TkSEMICOLON then
|
||||
container.ongoing_visibility = vis
|
||||
when TkDEF
|
||||
container.current_line_visibility = vis
|
||||
else
|
||||
update_visibility container, vis_type, vis, singleton
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# DO NOT MODIFY!!!!
|
||||
# This file is automatically generated by Racc 1.4.14
|
||||
# from Racc grammer file "".
|
||||
# from Racc grammar file "".
|
||||
#
|
||||
|
||||
require 'racc/parser.rb'
|
||||
|
@ -253,7 +253,7 @@ def next_token # :nodoc:
|
|||
[:STRINGLINE, line]
|
||||
end
|
||||
else
|
||||
raise "[BUG] parsing error may occured."
|
||||
raise "[BUG] parsing error may occurred."
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# DO NOT MODIFY!!!!
|
||||
# This file is automatically generated by Racc 1.4.14
|
||||
# from Racc grammer file "".
|
||||
# from Racc grammar file "".
|
||||
#
|
||||
|
||||
require 'racc/parser.rb'
|
||||
|
@ -704,9 +704,9 @@ Racc_token_to_s_table = [
|
|||
"ref_subst_strings_q",
|
||||
"ref_subst_strings_first",
|
||||
"ref_subst_ele2",
|
||||
"ref_subst_eles",
|
||||
"ref_subst_eels",
|
||||
"ref_subst_str_ele_first",
|
||||
"ref_subst_eles_q",
|
||||
"ref_subst_eels_q",
|
||||
"ref_subst_ele",
|
||||
"ref_subst_ele_q",
|
||||
"ref_subst_str_ele",
|
||||
|
|
|
@ -123,7 +123,7 @@ Output:
|
|||
|
||||
Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
|
||||
`+`, and `-`) as list markers. These three markers are
|
||||
interchangable; this:
|
||||
interchangeable; this:
|
||||
|
||||
* Candy.
|
||||
* Gum.
|
||||
|
|
|
@ -298,7 +298,7 @@ Quote Level from the Text menu.
|
|||
|
||||
Markdown supports ordered (numbered) and unordered (bulleted) lists.
|
||||
|
||||
Unordered lists use asterisks, pluses, and hyphens -- interchangably
|
||||
Unordered lists use asterisks, pluses, and hyphens -- interchangeably
|
||||
-- as list markers:
|
||||
|
||||
* Red
|
||||
|
|
|
@ -866,6 +866,27 @@ class TestRDocContext < XrefTestCase
|
|||
assert_equal [nil, 'Public', 'Internal'], titles
|
||||
end
|
||||
|
||||
def test_visibility_def
|
||||
assert_equal :private, @c6.find_method_named('priv1').visibility
|
||||
assert_equal :protected, @c6.find_method_named('prot1').visibility
|
||||
assert_equal :public, @c6.find_method_named('pub1').visibility
|
||||
assert_equal :private, @c6.find_method_named('priv2').visibility
|
||||
assert_equal :protected, @c6.find_method_named('prot2').visibility
|
||||
assert_equal :public, @c6.find_method_named('pub2').visibility
|
||||
assert_equal :private, @c6.find_method_named('priv3').visibility
|
||||
assert_equal :protected, @c6.find_method_named('prot3').visibility
|
||||
assert_equal :public, @c6.find_method_named('pub3').visibility
|
||||
assert_equal :private, @c6.find_method_named('priv4').visibility
|
||||
assert_equal :protected, @c6.find_method_named('prot4').visibility
|
||||
assert_equal :public, @c6.find_method_named('pub4').visibility
|
||||
assert_equal :private, @c6.find_method_named('priv5').visibility
|
||||
assert_equal :protected, @c6.find_method_named('prot5').visibility
|
||||
assert_equal :public, @c6.find_method_named('pub5').visibility
|
||||
assert_equal :private, @c6.find_method_named('priv6').visibility
|
||||
assert_equal :protected, @c6.find_method_named('prot6').visibility
|
||||
assert_equal :public, @c6.find_method_named('pub6').visibility
|
||||
end
|
||||
|
||||
def util_visibilities
|
||||
@pub = RDoc::AnyMethod.new nil, 'pub'
|
||||
@prot = RDoc::AnyMethod.new nil, 'prot'
|
||||
|
|
|
@ -59,7 +59,7 @@ Paragraphe 2.
|
|||
assert_equal expected, translate(raw)
|
||||
end
|
||||
|
||||
def test_translate_not_transalted_message
|
||||
def test_translate_not_translated_message
|
||||
nonexistent_paragraph = <<-PARAGRAPH.strip
|
||||
Nonexistent paragraph.
|
||||
PARAGRAPH
|
||||
|
|
|
@ -601,7 +601,7 @@ foo
|
|||
|
||||
para("Unordered (bulleted) lists use asterisks, pluses, and hyphens (<code>*</code>,\n" +
|
||||
"<code>+</code>, and <code>-</code>) as list markers. These three markers are\n" +
|
||||
"interchangable; this:"),
|
||||
"interchangeable; this:"),
|
||||
|
||||
verb("* Candy.\n",
|
||||
"* Gum.\n",
|
||||
|
@ -1090,7 +1090,7 @@ foo
|
|||
|
||||
para("Markdown supports ordered (numbered) and unordered (bulleted) lists."),
|
||||
|
||||
para("Unordered lists use asterisks, pluses, and hyphens -- interchangably\n" +
|
||||
para("Unordered lists use asterisks, pluses, and hyphens -- interchangeably\n" +
|
||||
"-- as list markers:"),
|
||||
|
||||
verb("* Red\n",
|
||||
|
|
|
@ -282,7 +282,7 @@ class TestRDocRIDriver < RDoc::TestCase
|
|||
assert_equal expected, out
|
||||
end
|
||||
|
||||
def test_add_method_overriden
|
||||
def test_add_method_overridden
|
||||
util_multi_store
|
||||
|
||||
out = doc
|
||||
|
@ -646,7 +646,7 @@ class TestRDocRIDriver < RDoc::TestCase
|
|||
assert_match %r%^=== Implementation from Foo%, out
|
||||
end
|
||||
|
||||
def test_display_method_overriden
|
||||
def test_display_method_overridden
|
||||
util_multi_store
|
||||
|
||||
out, = capture_io do
|
||||
|
@ -1455,10 +1455,10 @@ Foo::Bar#bother
|
|||
@inherit = @cFoo.add_method RDoc::AnyMethod.new(nil, 'inherit')
|
||||
@inherit.record_location @top_level
|
||||
|
||||
# overriden by Bar in multi_store
|
||||
@overriden = @cFoo.add_method RDoc::AnyMethod.new(nil, 'override')
|
||||
@overriden.comment = 'must not be displayed in Bar#override'
|
||||
@overriden.record_location @top_level
|
||||
# overridden by Bar in multi_store
|
||||
@overridden = @cFoo.add_method RDoc::AnyMethod.new(nil, 'override')
|
||||
@overridden.comment = 'must not be displayed in Bar#override'
|
||||
@overridden.record_location @top_level
|
||||
|
||||
@store1.save
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ class TestRDocStore < XrefTestCase
|
|||
|
||||
def test_all_classes_and_modules
|
||||
expected = %w[
|
||||
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1
|
||||
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6
|
||||
Child
|
||||
M1 M1::M2
|
||||
Parent
|
||||
|
@ -213,7 +213,7 @@ class TestRDocStore < XrefTestCase
|
|||
|
||||
def test_classes
|
||||
expected = %w[
|
||||
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1
|
||||
C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6
|
||||
Child
|
||||
Parent
|
||||
]
|
||||
|
|
|
@ -57,6 +57,31 @@ class C5
|
|||
end
|
||||
end
|
||||
|
||||
class C6
|
||||
private def priv1() end
|
||||
def pub1() end
|
||||
protected def prot1() end
|
||||
def pub2() end
|
||||
public def pub3() end
|
||||
def pub4() end
|
||||
|
||||
private
|
||||
private def priv2() end
|
||||
def priv3() end
|
||||
protected def prot2() end
|
||||
def priv4() end
|
||||
public def pub5() end
|
||||
def priv5() end
|
||||
|
||||
protected
|
||||
private def priv6() end
|
||||
def prot3() end
|
||||
protected def prot4() end
|
||||
def prot5() end
|
||||
public def pub6() end
|
||||
def prot6() end
|
||||
end
|
||||
|
||||
module M1
|
||||
def m
|
||||
end
|
||||
|
|
|
@ -51,6 +51,7 @@ class XrefTestCase < RDoc::TestCase
|
|||
@c5_c1 = @xref_data.find_module_named 'C5::C1'
|
||||
@c3_h1 = @xref_data.find_module_named 'C3::H1'
|
||||
@c3_h2 = @xref_data.find_module_named 'C3::H2'
|
||||
@c6 = @xref_data.find_module_named 'C6'
|
||||
|
||||
@m1 = @xref_data.find_module_named 'M1'
|
||||
@m1_m = @m1.method_list.first
|
||||
|
|
Загрузка…
Ссылка в новой задаче