ruby-changes:15550
From: drbrain <ko1@a...>
Date: Fri, 23 Apr 2010 11:32:45 +0900 (JST)
Subject: [ruby-changes:15550] Ruby:r27453 (trunk): Update to RDoc 2.5.6
drbrain 2010-04-23 11:32:20 +0900 (Fri, 23 Apr 2010) New Revision: 27453 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27453 Log: Update to RDoc 2.5.6 Modified files: trunk/ChangeLog trunk/NEWS trunk/lib/rdoc/any_method.rb trunk/lib/rdoc/code_object.rb trunk/lib/rdoc/generator/template/darkfish/rdoc.css trunk/lib/rdoc/markup/preprocess.rb trunk/lib/rdoc/options.rb trunk/lib/rdoc/parser/c.rb trunk/lib/rdoc/parser/ruby.rb trunk/lib/rdoc/parser/simple.rb trunk/lib/rdoc.rb trunk/test/rdoc/test_rdoc_code_object.rb trunk/test/rdoc/test_rdoc_options.rb trunk/test/rdoc/test_rdoc_parser_c.rb trunk/test/rdoc/test_rdoc_parser_ruby.rb trunk/test/rdoc/test_rdoc_parser_simple.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 27452) +++ ChangeLog (revision 27453) @@ -1,3 +1,7 @@ +Fri Apr 23 11:31:25 2010 Eric Hodel <drbrain@s...> + + * lib/rdoc: Update to RDoc 2.5.6. + Fri Apr 23 04:11:26 2010 Nobuyoshi Nakada <nobu@r...> * test/ripper/test_parser_events.rb (test_unterminated_regexp): Index: lib/rdoc.rb =================================================================== --- lib/rdoc.rb (revision 27452) +++ lib/rdoc.rb (revision 27453) @@ -383,7 +383,7 @@ ## # 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 Index: lib/rdoc/generator/template/darkfish/rdoc.css =================================================================== --- lib/rdoc/generator/template/darkfish/rdoc.css (revision 27452) +++ lib/rdoc/generator/template/darkfish/rdoc.css (revision 27453) @@ -103,9 +103,7 @@ list-style: none; } .indexpage ul :link, -.indexpage ul :visited, -.file #documentation ul :link, -.file #documentation ul :visited { +.indexpage ul :visited { font-size: 16px; } Index: lib/rdoc/markup/preprocess.rb =================================================================== --- lib/rdoc/markup/preprocess.rb (revision 27452) +++ lib/rdoc/markup/preprocess.rb (revision 27453) @@ -47,6 +47,7 @@ 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 Index: lib/rdoc/code_object.rb =================================================================== --- lib/rdoc/code_object.rb (revision 27452) +++ lib/rdoc/code_object.rb (revision 27453) @@ -55,6 +55,11 @@ attr_accessor :force_documentation ## + # Hash of arbitrary metadata for this CodeObject + + attr_reader :metadata + + ## # Our parent CodeObject attr_accessor :parent @@ -75,6 +80,7 @@ # Creates a new CodeObject that will document itself and its children def initialize + @metadata = {} @comment = '' @document_children = true Index: lib/rdoc/any_method.rb =================================================================== --- lib/rdoc/any_method.rb (revision 27452) +++ lib/rdoc/any_method.rb (revision 27453) @@ -68,7 +68,6 @@ @text = text @name = name - @aref = nil @aliases = [] @block_params = nil @call_seq = nil Index: lib/rdoc/parser/ruby.rb =================================================================== --- lib/rdoc/parser/ruby.rb (revision 27452) +++ lib/rdoc/parser/ruby.rb (revision 27453) @@ -404,7 +404,7 @@ @options.title = param '' else - warn "Unrecognized directive :#{directive}:" + @top_level.metadata[directive] = param false end end Index: lib/rdoc/parser/c.rb =================================================================== --- lib/rdoc/parser/c.rb (revision 27452) +++ lib/rdoc/parser/c.rb (revision 27453) @@ -670,7 +670,7 @@ @options.title = param '' else - warn "Unrecognized directive :#{directive}:" + context.metadata[directive] = param false end end Index: lib/rdoc/parser/simple.rb =================================================================== --- lib/rdoc/parser/simple.rb (revision 27452) +++ lib/rdoc/parser/simple.rb (revision 27453) @@ -7,6 +7,8 @@ parse_files_matching(//) + attr_reader :content # :nodoc: + ## # Prepare to parse a plain file @@ -16,7 +18,8 @@ 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 Index: lib/rdoc/options.rb =================================================================== --- lib/rdoc/options.rb (revision 27452) +++ lib/rdoc/options.rb (revision 27453) @@ -366,7 +366,7 @@ 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 Index: NEWS =================================================================== --- NEWS (revision 27452) +++ NEWS (revision 27453) @@ -211,7 +211,7 @@ * RDoc - * Updated to RDoc 2.5.5 + * Updated to RDoc 2.5.6 * logger Index: test/rdoc/test_rdoc_code_object.rb =================================================================== --- test/rdoc/test_rdoc_code_object.rb (revision 27452) +++ test/rdoc/test_rdoc_code_object.rb (revision 27453) @@ -61,6 +61,18 @@ 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 Index: test/rdoc/test_rdoc_options.rb =================================================================== --- test/rdoc/test_rdoc_options.rb (revision 27452) +++ test/rdoc/test_rdoc_options.rb (revision 27453) @@ -39,5 +39,16 @@ 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 Index: test/rdoc/test_rdoc_parser_ruby.rb =================================================================== --- test/rdoc/test_rdoc_parser_ruby.rb (revision 27452) +++ test/rdoc/test_rdoc_parser_ruby.rb (revision 27453) @@ -151,12 +151,15 @@ 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 Index: test/rdoc/test_rdoc_parser_c.rb =================================================================== --- test/rdoc/test_rdoc_parser_c.rb (revision 27452) +++ test/rdoc/test_rdoc_parser_c.rb (revision 27453) @@ -406,6 +406,17 @@ 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! */ Index: test/rdoc/test_rdoc_parser_simple.rb =================================================================== --- test/rdoc/test_rdoc_parser_simple.rb (revision 27452) +++ test/rdoc/test_rdoc_parser_simple.rb (revision 27453) @@ -22,6 +22,15 @@ @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; -*- -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/