mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rdoc.rb, lib/rdoc, test/rdoc: Update to RDoc 4.2.0.alpha(21b241a)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
02dade3b9e
commit
80325bab52
8 changed files with 55 additions and 5 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Thu Sep 11 10:03:16 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
|
||||||
|
|
||||||
|
* lib/rdoc.rb, lib/rdoc, test/rdoc: Update to RDoc 4.2.0.alpha(21b241a)
|
||||||
|
|
||||||
Wed Sep 10 17:52:25 2014 Koichi Sasada <ko1@atdot.net>
|
Wed Sep 10 17:52:25 2014 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* compile.c (rb_vm_addr2insn): rename to rb_vm_insn_addr2insn
|
* compile.c (rb_vm_addr2insn): rename to rb_vm_insn_addr2insn
|
||||||
|
|
|
@ -130,7 +130,7 @@ class RDoc::Markup::AttributeManager
|
||||||
# first do matching ones
|
# first do matching ones
|
||||||
tags = @matching_word_pairs.keys.join("")
|
tags = @matching_word_pairs.keys.join("")
|
||||||
|
|
||||||
re = /(^|\W)([#{tags}])([#:\\]?[\w.\/-]+?\S?)\2(\W|$)/
|
re = /(^|\W)([#{tags}])([#\\]?[\w:.\/-]+?\S?)\2(\W|$)/
|
||||||
|
|
||||||
1 while str.gsub!(re) do
|
1 while str.gsub!(re) do
|
||||||
attr = @matching_word_pairs[$2]
|
attr = @matching_word_pairs[$2]
|
||||||
|
|
|
@ -361,7 +361,12 @@ class RDoc::MethodAttr < RDoc::CodeObject
|
||||||
end
|
end
|
||||||
|
|
||||||
def pretty_print q # :nodoc:
|
def pretty_print q # :nodoc:
|
||||||
alias_for = @is_alias_for ? "alias for #{@is_alias_for.name}" : nil
|
alias_for =
|
||||||
|
if @is_alias_for.respond_to? :name then
|
||||||
|
"alias for #{@is_alias_for.name}"
|
||||||
|
elsif Array === @is_alias_for then
|
||||||
|
"alias for #{@is_alias_for.last}"
|
||||||
|
end
|
||||||
|
|
||||||
q.group 2, "[#{self.class.name} #{full_name} #{visibility}", "]" do
|
q.group 2, "[#{self.class.name} #{full_name} #{visibility}", "]" do
|
||||||
if alias_for then
|
if alias_for then
|
||||||
|
|
|
@ -1184,9 +1184,9 @@ class RDoc::RubyLex
|
||||||
str = if ltype == quoted and %w[" ' /].include? ltype then
|
str = if ltype == quoted and %w[" ' /].include? ltype then
|
||||||
ltype.dup
|
ltype.dup
|
||||||
elsif RUBY_VERSION > '1.9' then
|
elsif RUBY_VERSION > '1.9' then
|
||||||
"%#{type or PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]}"
|
"%#{type or PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]||quoted}"
|
||||||
else
|
else
|
||||||
"%#{type or PERCENT_LTYPE.index ltype}#{PERCENT_PAREN_REV[quoted]}"
|
"%#{type or PERCENT_LTYPE.index ltype}#{PERCENT_PAREN_REV[quoted]||quoted}"
|
||||||
end
|
end
|
||||||
|
|
||||||
subtype = nil
|
subtype = nil
|
||||||
|
|
|
@ -88,7 +88,7 @@ module RDoc::TokenStream
|
||||||
# Returns a string representation of the token stream
|
# Returns a string representation of the token stream
|
||||||
|
|
||||||
def tokens_to_s
|
def tokens_to_s
|
||||||
token_stream.map { |token| token.text }.join ''
|
token_stream.compact.map { |token| token.text }.join ''
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -130,6 +130,9 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
|
||||||
assert_equal(["cat ", @tt_on, "and", @tt_off, " dog"],
|
assert_equal(["cat ", @tt_on, "and", @tt_off, " dog"],
|
||||||
@am.flow("cat +and+ dog"))
|
@am.flow("cat +and+ dog"))
|
||||||
|
|
||||||
|
assert_equal(["cat ", @tt_on, "X::Y", @tt_off, " dog"],
|
||||||
|
@am.flow("cat +X::Y+ dog"))
|
||||||
|
|
||||||
assert_equal(["cat ", @bold_on, "a_b_c", @bold_off, " dog"],
|
assert_equal(["cat ", @bold_on, "a_b_c", @bold_off, " dog"],
|
||||||
@am.flow("cat *a_b_c* dog"))
|
@am.flow("cat *a_b_c* dog"))
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,33 @@ class TestRDocMethodAttr < XrefTestCase
|
||||||
refute_equal @c1_m, @parent_m
|
refute_equal @c1_m, @parent_m
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_pretty_print
|
||||||
|
temp_dir do |tmpdir|
|
||||||
|
s = RDoc::RI::Store.new tmpdir
|
||||||
|
s.rdoc = @rdoc
|
||||||
|
|
||||||
|
top_level = s.add_file 'file.rb'
|
||||||
|
meth_bang = RDoc::AnyMethod.new nil, 'method!'
|
||||||
|
meth_bang.record_location top_level
|
||||||
|
|
||||||
|
meth_bang_alias = RDoc::Alias.new nil, 'method!', 'method_bang', ''
|
||||||
|
meth_bang_alias.record_location top_level
|
||||||
|
|
||||||
|
klass = top_level.add_class RDoc::NormalClass, 'Object'
|
||||||
|
klass.add_method meth_bang
|
||||||
|
|
||||||
|
meth_bang.add_alias meth_bang_alias, klass
|
||||||
|
|
||||||
|
s.save
|
||||||
|
|
||||||
|
meth_alias_from_store = s.load_method 'Object', '#method_bang'
|
||||||
|
|
||||||
|
expected = "[RDoc::AnyMethod Object#method_bang public alias for method!]"
|
||||||
|
actual = mu_pp meth_alias_from_store
|
||||||
|
assert_equal expected, actual
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_to_s
|
def test_to_s
|
||||||
assert_equal 'RDoc::AnyMethod: C1#m', @c1_m.to_s
|
assert_equal 'RDoc::AnyMethod: C1#m', @c1_m.to_s
|
||||||
assert_equal 'RDoc::AnyMethod: C2#b', @c2_b.to_s
|
assert_equal 'RDoc::AnyMethod: C2#b', @c2_b.to_s
|
||||||
|
|
|
@ -231,6 +231,17 @@ U
|
||||||
assert_equal expected, tokens
|
assert_equal expected, tokens
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_class_tokenize_percent_w_quote
|
||||||
|
tokens = RDoc::RubyLex.tokenize '%w"hi"', nil
|
||||||
|
|
||||||
|
expected = [
|
||||||
|
@TK::TkDSTRING.new( 0, 1, 0, '%w"hi"'),
|
||||||
|
@TK::TkNL .new( 6, 1, 6, "\n"),
|
||||||
|
]
|
||||||
|
|
||||||
|
assert_equal expected, tokens
|
||||||
|
end
|
||||||
|
|
||||||
def test_class_tokenize_regexp
|
def test_class_tokenize_regexp
|
||||||
tokens = RDoc::RubyLex.tokenize "/hay/", nil
|
tokens = RDoc::RubyLex.tokenize "/hay/", nil
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue