[前][次][番号順一覧][スレッド一覧]

ruby-changes:20746

From: drbrain <ko1@a...>
Date: Mon, 1 Aug 2011 14:25:24 +0900 (JST)
Subject: [ruby-changes:20746] drbrain:r32794 (trunk): * lib/rdoc.rb: Import RDoc 3.9.1. Fixes bugs in the RDoc::Markup

drbrain	2011-08-01 14:25:13 +0900 (Mon, 01 Aug 2011)

  New Revision: 32794

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32794

  Log:
    * lib/rdoc.rb:  Import RDoc 3.9.1.  Fixes bugs in the RDoc::Markup
      parser.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rdoc/markup/parser.rb
    trunk/lib/rdoc/markup/to_html_crossref.rb
    trunk/lib/rdoc/text.rb
    trunk/lib/rdoc.rb
    trunk/test/rdoc/test_rdoc_markup_parser.rb
    trunk/test/rdoc/test_rdoc_markup_to_html_crossref.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32793)
+++ ChangeLog	(revision 32794)
@@ -1,3 +1,8 @@
+Mon Aug 01 14:24:56 2011  Eric Hodel  <drbrain@s...>
+
+	* 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@r...>
 
 	* insns.def (concatstrings): don't use initial ASCII-8BIT string.
Index: lib/rdoc.rb
===================================================================
--- lib/rdoc.rb	(revision 32793)
+++ lib/rdoc.rb	(revision 32794)
@@ -104,7 +104,7 @@
   ##
   # RDoc version you are using
 
-  VERSION = '3.9'
+  VERSION = '3.9.1'
 
   ##
   # Method visibilities
Index: lib/rdoc/markup/parser.rb
===================================================================
--- lib/rdoc/markup/parser.rb	(revision 32793)
+++ lib/rdoc/markup/parser.rb	(revision 32794)
@@ -86,11 +86,18 @@
   # Builds a Heading of +level+
 
   def build_heading level
-    _, text, = get  # TEXT
-    heading = RDoc::Markup::Heading.new level, text
-    skip :NEWLINE
+    type, text, = get
 
-    heading
+    text = case type
+           when :TEXT then
+             skip :NEWLINE
+             text
+           else
+             unget
+             ''
+           end
+
+    RDoc::Markup::Heading.new level, text
   end
 
   ##
Index: lib/rdoc/markup/to_html_crossref.rb
===================================================================
--- lib/rdoc/markup/to_html_crossref.rb	(revision 32793)
+++ lib/rdoc/markup/to_html_crossref.rb	(revision 32794)
@@ -97,7 +97,7 @@
   # 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
Index: lib/rdoc/text.rb
===================================================================
--- lib/rdoc/text.rb	(revision 32793)
+++ lib/rdoc/text.rb	(revision 32794)
@@ -126,7 +126,7 @@
 
 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
Index: test/rdoc/test_rdoc_markup_to_html_crossref.rb
===================================================================
--- test/rdoc/test_rdoc_markup_to_html_crossref.rb	(revision 32793)
+++ test/rdoc/test_rdoc_markup_to_html_crossref.rb	(revision 32794)
@@ -25,6 +25,14 @@
     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
Index: test/rdoc/test_rdoc_markup_parser.rb
===================================================================
--- test/rdoc/test_rdoc_markup_parser.rb	(revision 32793)
+++ test/rdoc/test_rdoc_markup_parser.rb	(revision 32794)
@@ -248,6 +248,23 @@
     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 @@
     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
 = =

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]