summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--NEWS2
-rw-r--r--lib/rdoc.rb2
-rw-r--r--lib/rdoc/any_method.rb1
-rw-r--r--lib/rdoc/code_object.rb6
-rw-r--r--lib/rdoc/generator/template/darkfish/rdoc.css4
-rw-r--r--lib/rdoc/markup/preprocess.rb1
-rw-r--r--lib/rdoc/options.rb2
-rw-r--r--lib/rdoc/parser/c.rb2
-rw-r--r--lib/rdoc/parser/ruby.rb2
-rw-r--r--lib/rdoc/parser/simple.rb5
-rw-r--r--test/rdoc/test_rdoc_code_object.rb12
-rw-r--r--test/rdoc/test_rdoc_options.rb11
-rw-r--r--test/rdoc/test_rdoc_parser_c.rb11
-rw-r--r--test/rdoc/test_rdoc_parser_ruby.rb7
-rw-r--r--test/rdoc/test_rdoc_parser_simple.rb9
16 files changed, 69 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index dab135106e7..b79c368a271 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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):
diff --git a/NEWS b/NEWS
index 10a4d9157a0..b43190a4d97 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 600cd92e0fb..3dbb63abd3a 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 d93e673215c..d742daa7b89 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 ea1a5eaffc2..f8c4e33f7e1 100644
--- a/lib/rdoc/code_object.rb
+++ b/lib/rdoc/code_object.rb
@@ -55,6 +55,11 @@ class RDoc::CodeObject
attr_accessor :force_documentation
##
+ # Hash of arbitrary metadata for this CodeObject
+
+ attr_reader :metadata
+
+ ##
# Our parent CodeObject
attr_accessor :parent
@@ -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 49052f4c8d3..ffe996001a1 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 b48f099119d..f3925cc692f 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 45b69186f97..7b3a23ca5c9 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 27236a3ff59..05b1e779256 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 e9cdc0b83eb..c8bab57607d 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 37125ff2995..25fa3c5159b 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 7e6098460fe..907bb7a3d51 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 a3b1876bf3d..62a5b2db540 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 38fb9084923..4f5d9e31710 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 d9a7a4f3d53..f4bd50ba16f 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 6edb51481ae..a83f105edd3 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; -*-