1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Update to RDoc 2.5.6

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2010-04-23 02:32:20 +00:00
parent 30014a6156
commit 400afca88a
16 changed files with 69 additions and 12 deletions

View file

@ -1,3 +1,7 @@
Fri Apr 23 11:31:25 2010 Eric Hodel <drbrain@segment7.net>
* lib/rdoc: Update to RDoc 2.5.6.
Fri Apr 23 04:11:26 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* test/ripper/test_parser_events.rb (test_unterminated_regexp):

2
NEWS
View file

@ -211,7 +211,7 @@ with all sufficient information, see the ChangeLog file.
* RDoc
* Updated to RDoc 2.5.5
* Updated to RDoc 2.5.6
* logger

View file

@ -383,7 +383,7 @@ module RDoc
##
# RDoc version you are using
VERSION = '2.5.5'
VERSION = '2.5.6'
##
# Name of the dotfile that contains the description of files to be processed

View file

@ -68,7 +68,6 @@ class RDoc::AnyMethod < RDoc::CodeObject
@text = text
@name = name
@aref = nil
@aliases = []
@block_params = nil
@call_seq = nil

View file

@ -54,6 +54,11 @@ class RDoc::CodeObject
attr_accessor :force_documentation
##
# Hash of arbitrary metadata for this CodeObject
attr_reader :metadata
##
# Our parent CodeObject
@ -75,6 +80,7 @@ class RDoc::CodeObject
# Creates a new CodeObject that will document itself and its children
def initialize
@metadata = {}
@comment = ''
@document_children = true

View file

@ -103,9 +103,7 @@ body.file p {
list-style: none;
}
.indexpage ul :link,
.indexpage ul :visited,
.file #documentation ul :link,
.file #documentation ul :visited {
.indexpage ul :visited {
font-size: 16px;
}

View file

@ -47,6 +47,7 @@ class RDoc::Markup::PreProcess
def include_file(name, indent)
if full_name = find_include_file(name) then
content = File.binread full_name
# HACK determine content type and force encoding
content = content.sub(/\A# .*coding[=:].*$/, '').lstrip
# strip leading '#'s, but only if all lines start with them

View file

@ -366,7 +366,7 @@ Usage: #{opt.program_name} [options] [names...]
end
end
if ignored and not quiet then
unless ignored.empty? or quiet then
$stderr.puts "invalid options: #{ignored.join ', '}"
$stderr.puts '(invalid options are ignored)'
end

View file

@ -670,7 +670,7 @@ class RDoc::Parser::C < RDoc::Parser
@options.title = param
''
else
warn "Unrecognized directive :#{directive}:"
context.metadata[directive] = param
false
end
end

View file

@ -404,7 +404,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
@options.title = param
''
else
warn "Unrecognized directive :#{directive}:"
@top_level.metadata[directive] = param
false
end
end

View file

@ -7,6 +7,8 @@ class RDoc::Parser::Simple < RDoc::Parser
parse_files_matching(//)
attr_reader :content # :nodoc:
##
# Prepare to parse a plain file
@ -16,7 +18,8 @@ class RDoc::Parser::Simple < RDoc::Parser
preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include
preprocess.handle @content do |directive, param|
warn "Unrecognized directive '#{directive}' in #{@file_name}"
top_level.metadata[directive] = param
false
end
end

View file

@ -61,6 +61,18 @@ class TestRDocCodeObject < XrefTestCase
assert @co.documented?
end
def test_metadata
assert_empty @co.metadata
@co.metadata['markup'] = 'not_rdoc'
expected = { 'markup' => 'not_rdoc' }
assert_equal expected, @co.metadata
assert_equal 'not_rdoc', @co.metadata['markup']
end
def test_parent_file_name
assert_equal '(unknown)', @co.parent_file_name
assert_equal 'xref_data.rb', @c1.parent_file_name

View file

@ -39,5 +39,16 @@ class TestRDocOptions < MiniTest::Unit::TestCase
assert_match %r%^invalid option: --bogus%, err
end
def test_parse_main
out, err = capture_io do
@options.parse %w[--main MAIN]
end
assert_empty out
assert_empty err
assert_equal 'MAIN', @options.main_page
end
end

View file

@ -406,6 +406,17 @@ Init_Foo(void) {
assert_equal "a comment for bar", bar.comment
end
def test_look_for_directives_in
parser = util_parser ''
comment = "# :markup: not_rdoc\n"
parser.look_for_directives_in @top_level, comment
assert_equal "# :markup: not_rdoc\n", comment
assert_equal 'not_rdoc', @top_level.metadata['markup']
end
def test_define_method
content = <<-EOF
/*Method Comment! */

View file

@ -151,11 +151,14 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
def test_look_for_directives_in_unhandled
util_parser ""
comment = "# :unhandled: \n# :title: hi\n"
comment = "# :unhandled: \n# :markup: not rdoc\n# :title: hi\n"
@parser.look_for_directives_in @top_level, comment
assert_equal "# :unhandled: \n", comment
assert_equal "# :unhandled: \n# :markup: not rdoc\n", comment
assert_equal nil, @top_level.metadata['unhandled']
assert_equal 'not rdoc', @top_level.metadata['markup']
assert_equal 'hi', @options.title
end

View file

@ -22,6 +22,15 @@ class TestRDocParserSimple < MiniTest::Unit::TestCase
@tempfile.close
end
def test_initialize_metadata
parser = util_parser ":unhandled: \n# :markup: not rdoc\n"
assert_equal nil, @top_level.metadata['unhandled']
assert_equal 'not rdoc', @top_level.metadata['markup']
assert_equal ":unhandled: \n# :markup: not rdoc\n", parser.content
end
def test_remove_coding_comment
parser = util_parser <<-TEXT
# -*- mode: rdoc; coding: utf-8; fill-column: 74; -*-