1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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

parser.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2011-08-01 05:25:13 +00:00
parent 7d2efc1fda
commit a429cafc4d
7 changed files with 61 additions and 7 deletions

View file

@ -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> Mon Aug 1 12:00:35 2011 NARUSE, Yui <naruse@ruby-lang.org>
* insns.def (concatstrings): don't use initial ASCII-8BIT string. * insns.def (concatstrings): don't use initial ASCII-8BIT string.

View file

@ -104,7 +104,7 @@ module RDoc
## ##
# RDoc version you are using # RDoc version you are using
VERSION = '3.9' VERSION = '3.9.1'
## ##
# Method visibilities # Method visibilities

View file

@ -86,11 +86,18 @@ class RDoc::Markup::Parser
# Builds a Heading of +level+ # Builds a Heading of +level+
def build_heading level def build_heading level
_, text, = get # TEXT type, text, = get
heading = RDoc::Markup::Heading.new level, text
skip :NEWLINE
heading text = case type
when :TEXT then
skip :NEWLINE
text
else
unget
''
end
RDoc::Markup::Heading.new level, text
end end
## ##

View file

@ -97,7 +97,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
# RDoc::Markup::ToHtml to handle other schemes. # RDoc::Markup::ToHtml to handle other schemes.
def gen_url url, text def gen_url url, text
super unless url =~ /\Ardoc-ref:/ return super unless url =~ /\Ardoc-ref:/
cross_reference $', text cross_reference $', text
end end

View file

@ -126,7 +126,7 @@ Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} #{RUBY_RELEASE_DATE}
Please file a bug report with the above information at: 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 EOF
raise raise

View file

@ -248,6 +248,23 @@ the time
assert_equal expected, @RMP.parse(str).parts assert_equal expected, @RMP.parse(str).parts
end 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 def test_parse_heading_heading
str = '= =' str = '= ='
@ -1085,6 +1102,23 @@ the time
assert_equal expected, @RMP.tokenize(str) assert_equal expected, @RMP.tokenize(str)
end 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 def test_tokenize_heading_heading
str = <<-STR str = <<-STR
= = = =

View file

@ -25,6 +25,14 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
assert_equal "\n<p><a href=\"C1.html\">C1</a></p>\n", result assert_equal "\n<p><a href=\"C1.html\">C1</a></p>\n", result
end 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 def test_handle_special_CROSSREF
assert_equal "<a href=\"C2/C3.html\">C2::C3</a>", SPECIAL('C2::C3') assert_equal "<a href=\"C2/C3.html\">C2::C3</a>", SPECIAL('C2::C3')
end end