diff --git a/ChangeLog b/ChangeLog index dab135106e..b79c368a27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Apr 23 11:31:25 2010 Eric Hodel + + * lib/rdoc: Update to RDoc 2.5.6. + Fri Apr 23 04:11:26 2010 Nobuyoshi Nakada * test/ripper/test_parser_events.rb (test_unterminated_regexp): diff --git a/NEWS b/NEWS index 10a4d9157a..b43190a4d9 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/lib/rdoc.rb b/lib/rdoc.rb index 600cd92e0f..3dbb63abd3 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -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 diff --git a/lib/rdoc/any_method.rb b/lib/rdoc/any_method.rb index d93e673215..d742daa7b8 100644 --- a/lib/rdoc/any_method.rb +++ b/lib/rdoc/any_method.rb @@ -68,7 +68,6 @@ class RDoc::AnyMethod < RDoc::CodeObject @text = text @name = name - @aref = nil @aliases = [] @block_params = nil @call_seq = nil diff --git a/lib/rdoc/code_object.rb b/lib/rdoc/code_object.rb index ea1a5eaffc..f8c4e33f7e 100644 --- a/lib/rdoc/code_object.rb +++ b/lib/rdoc/code_object.rb @@ -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 diff --git a/lib/rdoc/generator/template/darkfish/rdoc.css b/lib/rdoc/generator/template/darkfish/rdoc.css index 49052f4c8d..ffe996001a 100644 --- a/lib/rdoc/generator/template/darkfish/rdoc.css +++ b/lib/rdoc/generator/template/darkfish/rdoc.css @@ -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; } diff --git a/lib/rdoc/markup/preprocess.rb b/lib/rdoc/markup/preprocess.rb index b48f099119..f3925cc692 100644 --- a/lib/rdoc/markup/preprocess.rb +++ b/lib/rdoc/markup/preprocess.rb @@ -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 diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index 45b69186f9..7b3a23ca5c 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -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 diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 27236a3ff5..05b1e77925 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -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 diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index e9cdc0b83e..c8bab57607 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -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 diff --git a/lib/rdoc/parser/simple.rb b/lib/rdoc/parser/simple.rb index 37125ff299..25fa3c5159 100644 --- a/lib/rdoc/parser/simple.rb +++ b/lib/rdoc/parser/simple.rb @@ -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 diff --git a/test/rdoc/test_rdoc_code_object.rb b/test/rdoc/test_rdoc_code_object.rb index 7e6098460f..907bb7a3d5 100644 --- a/test/rdoc/test_rdoc_code_object.rb +++ b/test/rdoc/test_rdoc_code_object.rb @@ -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 diff --git a/test/rdoc/test_rdoc_options.rb b/test/rdoc/test_rdoc_options.rb index a3b1876bf3..62a5b2db54 100644 --- a/test/rdoc/test_rdoc_options.rb +++ b/test/rdoc/test_rdoc_options.rb @@ -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 diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb index 38fb908492..4f5d9e3171 100644 --- a/test/rdoc/test_rdoc_parser_c.rb +++ b/test/rdoc/test_rdoc_parser_c.rb @@ -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! */ diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb index d9a7a4f3d5..f4bd50ba16 100644 --- a/test/rdoc/test_rdoc_parser_ruby.rb +++ b/test/rdoc/test_rdoc_parser_ruby.rb @@ -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 diff --git a/test/rdoc/test_rdoc_parser_simple.rb b/test/rdoc/test_rdoc_parser_simple.rb index 6edb51481a..a83f105edd 100644 --- a/test/rdoc/test_rdoc_parser_simple.rb +++ b/test/rdoc/test_rdoc_parser_simple.rb @@ -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; -*-