diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-20 03:57:08 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-20 03:57:08 +0000 |
commit | ec6cacf00ad0dcf8a37cdfe2f31e6a06cd2a7262 (patch) | |
tree | 6e05dd5c37d078c36168c4887b3ddea5d9e0a720 /test/rdoc | |
parent | 440714529477663f19a683f2ccee8f568a5481c6 (diff) | |
download | ruby-ec6cacf00ad0dcf8a37cdfe2f31e6a06cd2a7262.tar.gz |
* lib/rdoc/markup/to_html.rb (class RDoc): Added current heading and
top links to headings.
* lib/rdoc/generator/template/darkfish/rdoc.css: ditto
* test/rdoc/test_rdoc_generator_markup.rb: Test for above
* test/rdoc/test_rdoc_markup_to_html.rb: ditto
* test/rdoc/test_rdoc_comment.rb: Removed trailing whitespace.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc')
-rw-r--r-- | test/rdoc/test_rdoc_comment.rb | 2 | ||||
-rw-r--r-- | test/rdoc/test_rdoc_generator_markup.rb | 5 | ||||
-rw-r--r-- | test/rdoc/test_rdoc_markup_to_html.rb | 62 |
3 files changed, 57 insertions, 12 deletions
diff --git a/test/rdoc/test_rdoc_comment.rb b/test/rdoc/test_rdoc_comment.rb index 4d0d54edca..2a1318b66c 100644 --- a/test/rdoc/test_rdoc_comment.rb +++ b/test/rdoc/test_rdoc_comment.rb @@ -70,7 +70,7 @@ call-seq: comment = RDoc::Comment.new <<-COMMENT, @top_level # call-seq: # bla => true or false -#\s +# # moar comment COMMENT diff --git a/test/rdoc/test_rdoc_generator_markup.rb b/test/rdoc/test_rdoc_generator_markup.rb index 1b44085283..b3b5c04588 100644 --- a/test/rdoc/test_rdoc_generator_markup.rb +++ b/test/rdoc/test_rdoc_generator_markup.rb @@ -37,7 +37,10 @@ class TestRDocGeneratorMarkup < RDoc::TestCase def test_description @comment = '= Hello' - assert_equal "\n<h1 id=\"label-Hello\">Hello</h1>\n", description + links = '<span><a href="#label-Hello">¶</a> ' + + '<a href="#documentation">↑</a></span>' + + assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", description end def test_formatter diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb index ffff6895d1..ebd2fe7dd2 100644 --- a/test/rdoc/test_rdoc_markup_to_html.rb +++ b/test/rdoc/test_rdoc_markup_to_html.rb @@ -23,32 +23,55 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase end def accept_heading - assert_equal "\n<h5 id=\"label-Hello\">Hello</h5>\n", @to.res.join + links = '<span><a href="#label-Hello">¶</a> ' + + '<a href="#documentation">↑</a></span>' + expected = "\n<h5 id=\"label-Hello\">Hello#{links}</h5>\n" + + assert_equal expected, @to.res.join end def accept_heading_1 - assert_equal "\n<h1 id=\"label-Hello\">Hello</h1>\n", @to.res.join + links = '<span><a href="#label-Hello">¶</a> ' + + '<a href="#documentation">↑</a></span>' + + assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", @to.res.join end def accept_heading_2 - assert_equal "\n<h2 id=\"label-Hello\">Hello</h2>\n", @to.res.join + links = '<span><a href="#label-Hello">¶</a> ' + + '<a href="#documentation">↑</a></span>' + + assert_equal "\n<h2 id=\"label-Hello\">Hello#{links}</h2>\n", @to.res.join end def accept_heading_3 - assert_equal "\n<h3 id=\"label-Hello\">Hello</h3>\n", @to.res.join + links = '<span><a href="#label-Hello">¶</a> ' + + '<a href="#documentation">↑</a></span>' + + assert_equal "\n<h3 id=\"label-Hello\">Hello#{links}</h3>\n", @to.res.join end def accept_heading_4 - assert_equal "\n<h4 id=\"label-Hello\">Hello</h4>\n", @to.res.join + links = '<span><a href="#label-Hello">¶</a> ' + + '<a href="#documentation">↑</a></span>' + + assert_equal "\n<h4 id=\"label-Hello\">Hello#{links}</h4>\n", @to.res.join end def accept_heading_b - assert_equal "\n<h1 id=\"label-Hello\"><strong>Hello</strong></h1>\n", + links = '<span><a href="#label-Hello">¶</a> ' + + '<a href="#documentation">↑</a></span>' + inner = "<strong>Hello</strong>" + + assert_equal "\n<h1 id=\"label-Hello\">#{inner}#{links}</h1>\n", @to.res.join end def accept_heading_suppressed_crossref - assert_equal "\n<h1 id=\"label-Hello\">Hello</h1>\n", @to.res.join + links = '<span><a href="#label-Hello">¶</a> ' + + '<a href="#documentation">↑</a></span>' + + assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", @to.res.join end def accept_list_end_bullet @@ -324,7 +347,10 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase @to.accept_heading @RM::Heading.new(7, 'Hello') - assert_equal "\n<h6 id=\"label-Hello\">Hello</h6>\n", @to.res.join + links = '<span><a href="#label-Hello">¶</a> ' + + '<a href="#documentation">↑</a></span>' + + assert_equal "\n<h6 id=\"label-Hello\">Hello#{links}</h6>\n", @to.res.join end def test_accept_heading_aref_class @@ -333,7 +359,10 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase @to.accept_heading @RM::Heading.new(1, 'Hello') - assert_equal "\n<h1 id=\"label-Hello\">Hello</h1>\n", + links = '<span><a href="#label-Hello">¶</a> ' + + '<a href="#documentation">↑</a></span>' + + assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", @to.res.join end @@ -343,10 +372,23 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase @to.accept_heading @RM::Heading.new(1, 'Hello') - assert_equal "\n<h1 id=\"method-i-foo-label-Hello\">Hello</h1>\n", + links = '<span><a href="#method-i-foo-label-Hello">¶</a> ' + + '<a href="#documentation">↑</a></span>' + + assert_equal "\n<h1 id=\"method-i-foo-label-Hello\">Hello#{links}</h1>\n", @to.res.join end + def test_accept_heading_pipe + @options.pipe = true + + @to.start_accepting + + @to.accept_heading @RM::Heading.new(1, 'Hello') + + assert_equal "\n<h1 id=\"label-Hello\">Hello</h1>\n", @to.res.join + end + def test_accept_verbatim_parseable verb = @RM::Verbatim.new("class C\n", "end\n") |