aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/rdoc.rb2
-rw-r--r--lib/rdoc/markup/parser.rb17
-rw-r--r--lib/rdoc/markup/to_html_crossref.rb2
-rw-r--r--lib/rdoc/text.rb2
-rw-r--r--test/rdoc/test_rdoc_markup_parser.rb34
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_crossref.rb8
7 files changed, 62 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 8b7428bae1..1756438a2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Aug 01 14:24:56 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc.rb: Import RDoc 3.9.1. Fixes bugs in the RDoc::Markup
+ parser.
+
Mon Aug 1 12:00:35 2011 NARUSE, Yui <naruse@ruby-lang.org>
* insns.def (concatstrings): don't use initial ASCII-8BIT string.
diff --git a/lib/rdoc.rb b/lib/rdoc.rb
index e05e22a3a1..86c194f8ba 100644
--- a/lib/rdoc.rb
+++ b/lib/rdoc.rb
@@ -104,7 +104,7 @@ module RDoc
##
# RDoc version you are using
- VERSION = '3.9'
+ VERSION = '3.9.1'
##
# Method visibilities
diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb
index 3ab72ee5d5..c18ce821fb 100644
--- a/lib/rdoc/markup/parser.rb
+++ b/lib/rdoc/markup/parser.rb
@@ -86,11 +86,18 @@ class RDoc::Markup::Parser
# Builds a Heading of +level+
def build_heading level
- _, text, = get # TEXT
- heading = RDoc::Markup::Heading.new level, text
- skip :NEWLINE
-
- heading
+ type, text, = get
+
+ text = case type
+ when :TEXT then
+ skip :NEWLINE
+ text
+ else
+ unget
+ ''
+ end
+
+ RDoc::Markup::Heading.new level, text
end
##
diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb
index 5175b79192..450ea960b5 100644
--- a/lib/rdoc/markup/to_html_crossref.rb
+++ b/lib/rdoc/markup/to_html_crossref.rb
@@ -97,7 +97,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
# RDoc::Markup::ToHtml to handle other schemes.
def gen_url url, text
- super unless url =~ /\Ardoc-ref:/
+ return super unless url =~ /\Ardoc-ref:/
cross_reference $', text
end
diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb
index aec334b545..3ac55ed560 100644
--- a/lib/rdoc/text.rb
+++ b/lib/rdoc/text.rb
@@ -126,7 +126,7 @@ Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} #{RUBY_RELEASE_DATE}
Please file a bug report with the above information at:
-http://rubyforge.org/tracker/?atid=2472&group_id=627&func=browse
+https://github.com/rdoc/rdoc/issues
EOF
raise
diff --git a/test/rdoc/test_rdoc_markup_parser.rb b/test/rdoc/test_rdoc_markup_parser.rb
index a9d2a1b4fb..e214c4defc 100644
--- a/test/rdoc/test_rdoc_markup_parser.rb
+++ b/test/rdoc/test_rdoc_markup_parser.rb
@@ -248,6 +248,23 @@ the time
assert_equal expected, @RMP.parse(str).parts
end
+ def test_parse_heading_empty
+ str = <<-STR
+===
+* bullet
+ STR
+
+ expected = [
+ @RM::Heading.new(3, ''),
+ @RM::BlankLine.new,
+ @RM::List.new(:BULLET, *[
+ @RM::ListItem.new(nil,
+ @RM::Paragraph.new('bullet'))]),
+ ]
+
+ assert_equal expected, @RMP.parse(str).parts
+ end
+
def test_parse_heading_heading
str = '= ='
@@ -1085,6 +1102,23 @@ the time
assert_equal expected, @RMP.tokenize(str)
end
+ def test_tokenize_heading_empty
+ str = <<-STR
+===
+* bullet
+ STR
+
+ expected = [
+ [:HEADER, 3, 0, 0],
+ [:NEWLINE, "\n", 3, 0],
+ [:BULLET, "*", 0, 1],
+ [:TEXT, "bullet", 2, 1],
+ [:NEWLINE, "\n", 8, 1],
+ ]
+
+ assert_equal expected, @RMP.tokenize(str)
+ end
+
def test_tokenize_heading_heading
str = <<-STR
= =
diff --git a/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
index 4611e45309..2c566f0140 100644
--- a/test/rdoc/test_rdoc_markup_to_html_crossref.rb
+++ b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
@@ -25,6 +25,14 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
assert_equal "\n<p><a href=\"C1.html\">C1</a></p>\n", result
end
+ def test_gen_url
+ assert_equal '<a href="C1.html">Some class</a>',
+ @to.gen_url('rdoc-ref:C1', 'Some class')
+
+ assert_equal '<a href="http://example">HTTP example</a>',
+ @to.gen_url('http://example', 'HTTP example')
+ end
+
def test_handle_special_CROSSREF
assert_equal "<a href=\"C2/C3.html\">C2::C3</a>", SPECIAL('C2::C3')
end