Skip to content

Commit

Permalink
lib/rdoc/markup/to_html.rb (accept_heading): Fix page-top link.
Browse files Browse the repository at this point in the history
99f7210 introduced jump-to-top link with ID `top`. 5f15520 introduced page-top link without corresponding target element. Should probably reuse existing ID.
  • Loading branch information
blackwinter committed Oct 16, 2014
1 parent 21b241a commit 45f3ea2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/rdoc/markup/to_html.rb
Expand Up @@ -286,7 +286,7 @@ def accept_heading heading
@res << to_html(heading.text)
unless @options.pipe then
@res << "<span><a href=\"##{label}\">&para;</a>"
@res << " <a href=\"#documentation\">&uarr;</a></span>"
@res << " <a href=\"#top\">&uarr;</a></span>"
end
@res << "</h#{level}>\n"
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_rdoc_generator_markup.rb
Expand Up @@ -38,7 +38,7 @@ def test_description
@comment = '= Hello'

links = '<span><a href="#label-Hello">&para;</a> ' +
'<a href="#documentation">&uarr;</a></span>'
'<a href="#top">&uarr;</a></span>'

assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", description
end
Expand Down
22 changes: 11 additions & 11 deletions test/test_rdoc_markup_to_html.rb
Expand Up @@ -24,43 +24,43 @@ def accept_document

def accept_heading
links = '<span><a href="#label-Hello">&para;</a> ' +
'<a href="#documentation">&uarr;</a></span>'
'<a href="#top">&uarr;</a></span>'
expected = "\n<h5 id=\"label-Hello\">Hello#{links}</h5>\n"

assert_equal expected, @to.res.join
end

def accept_heading_1
links = '<span><a href="#label-Hello">&para;</a> ' +
'<a href="#documentation">&uarr;</a></span>'
'<a href="#top">&uarr;</a></span>'

assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", @to.res.join
end

def accept_heading_2
links = '<span><a href="#label-Hello">&para;</a> ' +
'<a href="#documentation">&uarr;</a></span>'
'<a href="#top">&uarr;</a></span>'

assert_equal "\n<h2 id=\"label-Hello\">Hello#{links}</h2>\n", @to.res.join
end

def accept_heading_3
links = '<span><a href="#label-Hello">&para;</a> ' +
'<a href="#documentation">&uarr;</a></span>'
'<a href="#top">&uarr;</a></span>'

assert_equal "\n<h3 id=\"label-Hello\">Hello#{links}</h3>\n", @to.res.join
end

def accept_heading_4
links = '<span><a href="#label-Hello">&para;</a> ' +
'<a href="#documentation">&uarr;</a></span>'
'<a href="#top">&uarr;</a></span>'

assert_equal "\n<h4 id=\"label-Hello\">Hello#{links}</h4>\n", @to.res.join
end

def accept_heading_b
links = '<span><a href="#label-Hello">&para;</a> ' +
'<a href="#documentation">&uarr;</a></span>'
'<a href="#top">&uarr;</a></span>'
inner = "<strong>Hello</strong>"

assert_equal "\n<h1 id=\"label-Hello\">#{inner}#{links}</h1>\n",
Expand All @@ -69,7 +69,7 @@ def accept_heading_b

def accept_heading_suppressed_crossref
links = '<span><a href="#label-Hello">&para;</a> ' +
'<a href="#documentation">&uarr;</a></span>'
'<a href="#top">&uarr;</a></span>'

assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n", @to.res.join
end
Expand Down Expand Up @@ -348,7 +348,7 @@ def test_accept_heading_7
@to.accept_heading @RM::Heading.new(7, 'Hello')

links = '<span><a href="#label-Hello">&para;</a> ' +
'<a href="#documentation">&uarr;</a></span>'
'<a href="#top">&uarr;</a></span>'

assert_equal "\n<h6 id=\"label-Hello\">Hello#{links}</h6>\n", @to.res.join
end
Expand All @@ -360,7 +360,7 @@ def test_accept_heading_aref_class
@to.accept_heading head(1, 'Hello')

links = '<span><a href="#class-Foo-label-Hello">&para;</a> ' +
'<a href="#documentation">&uarr;</a></span>'
'<a href="#top">&uarr;</a></span>'

assert_equal "\n<h1 id=\"class-Foo-label-Hello\">Hello#{links}</h1>\n",
@to.res.join
Expand All @@ -373,7 +373,7 @@ def test_accept_heading_aref_method
@to.accept_heading @RM::Heading.new(1, 'Hello')

links = '<span><a href="#method-i-foo-label-Hello">&para;</a> ' +
'<a href="#documentation">&uarr;</a></span>'
'<a href="#top">&uarr;</a></span>'

assert_equal "\n<h1 id=\"method-i-foo-label-Hello\">Hello#{links}</h1>\n",
@to.res.join
Expand Down Expand Up @@ -404,7 +404,7 @@ def test_accept_heading_output_decoration

@to.accept_heading @RM::Heading.new(1, 'Hello')

assert_equal "\n<h1>Hello<span><a href=\"#label-Hello\">&para;</a> <a href=\"#documentation\">&uarr;</a></span></h1>\n", @to.res.join
assert_equal "\n<h1>Hello<span><a href=\"#label-Hello\">&para;</a> <a href=\"#top\">&uarr;</a></span></h1>\n", @to.res.join
end

def test_accept_heading_output_decoration_with_pipe
Expand Down

0 comments on commit 45f3ea2

Please sign in to comment.